Makefile.in: Remove all bytecode support.

* Makefile.in: Remove all bytecode support.
        (OBJS): Make sure last entry is a real object file, not EXTRA_OBJS.
        * emit-rtl.c: Remove all bytecode support.
        * expr.c, expr.h function.c, integrate.c: Likewise.
        * output.h, regclass.c, rtl.h, stmt.c, toplev.c: Likewise.
        * tree.h, varasm.c: Likewise.
        * bi-*, bc-*: Delete bytecode related files.
Bytecode suppors disappears :-)

From-SVN: r17432
This commit is contained in:
Jeffrey A Law 1998-01-20 08:55:07 +00:00 committed by Jeff Law
parent 6885fc8771
commit b93a436e6b
30 changed files with 190 additions and 7065 deletions

View File

@ -1,3 +1,14 @@
Tue Jan 20 09:29:09 1998 Jeffrey A Law (law@cygnus.com)
* Makefile.in: Remove all bytecode support.
(OBJS): Make sure last entry is a real object file, not EXTRA_OBJS.
* emit-rtl.c: Remove all bytecode support.
* expr.c, expr.h function.c, integrate.c: Likewise.
* output.h, regclass.c, rtl.h, stmt.c, toplev.c: Likewise.
* tree.h, varasm.c: Likewise.
* bi-*, bc-*: Delete bytecode related files.
Tue Jan 20 09:02:31 1998 Gavin Koch (gavin@cygnus.com)
* mips/mips.md (divsi3,divdi3,modsi3,moddi3,udivsi3,udivdi3,

View File

@ -579,12 +579,6 @@ C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \
# Language-specific object files for C.
C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
# 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
SCHED_PREFIX = @sched_prefix@
SCHED_CFLAGS = @sched_cflags@
@ -597,7 +591,7 @@ OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o \
insn-peep.o reorg.o $(SCHED_PREFIX)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)
profile.o insn-attrtab.o $(out_object_file) getpwd.o $(EXTRA_OBJS) convert.o
# 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
@ -620,7 +614,6 @@ STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \
genextract$(build_exeext) genflags$(build_exeext) gencodes$(build_exeext) \
genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \
genattr$(build_exeext) genopinit$(build_exeext) \
$(BC_ALL) \
stamp-bcarity stamp-bcopcode stamp-bcopname \
bi-arity$(build_exeext) bi-opcode$(build_exeext) bi-opname$(build_exeext) \
xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) \
@ -675,7 +668,6 @@ CONFIG_H =
RTL_BASE_H = rtl.h rtl.def gansidecl.h machmode.h machmode.def
RTL_H = $(RTL_BASE_H) genrtl.h
TREE_H = tree.h real.h tree.def gansidecl.h machmode.h machmode.def
BYTECODE_H = bytecode.h bc-emit.h bc-optab.h
BASIC_BLOCK_H = basic-block.h bitmap.h
DEMANGLE_H = demangle.h gansidecl.h
RECOG_H = recog.h gansidecl.h
@ -789,8 +781,8 @@ 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
stamp-objlist: $(OBJS)
echo " $(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
@ -811,8 +803,8 @@ specs: xgcc
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)
cc1: $(P) $(C_OBJS) $(OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(OBJS) $(LIBS)
# Copy float.h from its source.
gfloat.h: $(FLOAT_H)
@ -1324,7 +1316,7 @@ 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 \
toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_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) \
@ -1338,21 +1330,19 @@ 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
output.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
$(RECOG_H) output.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
loop.h $(RECOG_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
typeclass.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 regs.h
expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
@ -1365,22 +1355,20 @@ 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 \
insn-config.h bytecode.h obstack.h xcoffout.h c-pragma.h
insn-config.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 expr.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 except.h \
function.h regs.h insn-config.h $(RECOG_H) real.h expr.h obstack.h \
bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h bc-emit.h \
bc-opname.h
function.h regs.h insn-config.h $(RECOG_H) real.h expr.h obstack.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 output.h $(RECOG_H) except.h
output.h $(RECOG_H) except.h
jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
insn-config.h insn-flags.h $(RECOG_H) expr.h real.h except.h
@ -1400,7 +1388,7 @@ 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
$(BASIC_BLOCK_H) regs.h insn-config.h $(RECOG_H) reload.h real.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
bitmap.o : bitmap.c $(CONFIG_H) $(RTL_H) flags.h $(BASIC_BLOCK_H) regs.h
@ -1735,74 +1723,6 @@ $(HOST_PREFIX_1)malloc.o: malloc.c
# 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.
@ -2112,7 +2032,7 @@ INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi
# (less duplicated code).
mostlyclean: bytecode.mostlyclean lang.mostlyclean
mostlyclean: lang.mostlyclean
-rm -f $(STAGESTUFF)
# Delete the temporary source copies for cross compilation.
-rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
@ -2153,7 +2073,7 @@ mostlyclean: bytecode.mostlyclean lang.mostlyclean
# Delete all files made by compilation
# that don't exist in the distribution.
clean: mostlyclean bytecode.clean lang.clean
clean: mostlyclean 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,
@ -2179,7 +2099,7 @@ clean: mostlyclean bytecode.clean lang.clean
# Delete all files that users would normally create
# while building and installing GCC.
distclean: clean bytecode.distclean lang.distclean
distclean: clean lang.distclean
-rm -f tm.h config.h auto-config.h tconfig.h hconfig.h md cstamp-h
-rm -f config.status config.run config.cache config.bak
-rm -f Make-lang Make-hooks Make-host Make-target
@ -2214,7 +2134,7 @@ extraclean: distclean lang.extraclean
maintainer-clean:
@echo 'This command is intended for maintainers to use; it'
@echo 'deletes files that may need special tools to rebuild.'
$(MAKE) distclean bytecode.maintainer-clean lang.maintainer-clean
$(MAKE) distclean lang.maintainer-clean
-rm -f c-parse.y c-gperf.h
-rm -f c-parse.c c-parse.h c-parse.output
-rm -f cexp.c cexp.output TAGS

File diff suppressed because it is too large Load Diff

View File

@ -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();

View File

@ -1,810 +0,0 @@
/* Bytecode conversion definitions for GNU C-compiler.
Copyright (C) 1993, 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 <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#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"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef NEED_DECLARATION_FREE
extern void free PROTO((void *));
#endif
#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 ();
}

View File

@ -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[];

View File

@ -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)

View File

@ -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

View File

@ -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);
}

View File

@ -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();

View File

@ -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;
}
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -1,980 +0,0 @@
/* A Bison parser, made from bi-parser.y with Bison version GNU Bison version 1.24
*/
#define YYBISON 1 /* Identify Bison output. */
#define DEFOP 258
#define STRING 259
#line 22 "bi-parser.y"
#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 ();
#line 44 "bi-parser.y"
typedef union
{
char *string;
struct def *def;
struct variation *variation;
struct node *node;
} YYSTYPE;
#ifndef YYLTYPE
typedef
struct yyltype
{
int timestamp;
int first_line;
int first_column;
int last_line;
int last_column;
char *text;
}
yyltype;
#define YYLTYPE yyltype
#endif
#include <stdio.h>
#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif
#define YYFINAL 39
#define YYFLAG -32768
#define YYNTBASE 8
#define YYTRANSLATE(x) ((unsigned)(x) <= 259 ? yytranslate[x] : 17)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 5,
7, 2, 2, 6, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 3, 4
};
#if YYDEBUG != 0
static const short yyprhs[] = { 0,
0, 2, 4, 7, 18, 20, 24, 28, 34, 42,
52, 53, 55, 59, 60, 62, 66
};
static const short yyrhs[] = { 9,
0, 10, 0, 9, 10, 0, 3, 5, 4, 6,
13, 6, 5, 11, 7, 7, 0, 12, 0, 11,
6, 12, 0, 5, 13, 7, 0, 5, 13, 6,
14, 7, 0, 5, 13, 6, 14, 6, 14, 7,
0, 5, 13, 6, 14, 6, 14, 6, 14, 7,
0, 0, 4, 0, 5, 15, 7, 0, 0, 16,
0, 16, 6, 15, 0, 4, 0
};
#endif
#if YYDEBUG != 0
static const short yyrline[] = { 0,
60, 65, 67, 71, 76, 78, 82, 85, 87, 89,
93, 95, 98, 101, 105, 108, 112
};
static const char * const yytname[] = { "$","error","$undefined.","DEFOP",
"STRING","'('","','","')'","top","defs","def","variations","variation","opt_string",
"list","items","item",""
};
#endif
static const short yyr1[] = { 0,
8, 9, 9, 10, 11, 11, 12, 12, 12, 12,
13, 13, 14, 14, 15, 15, 16
};
static const short yyr2[] = { 0,
1, 1, 2, 10, 1, 3, 3, 5, 7, 9,
0, 1, 3, 0, 1, 3, 1
};
static const short yydefact[] = { 0,
0, 1, 2, 0, 3, 0, 11, 12, 0, 0,
0, 11, 0, 5, 0, 0, 0, 14, 7, 6,
4, 0, 0, 17, 0, 15, 14, 8, 13, 0,
0, 16, 14, 9, 0, 10, 0, 0, 0
};
static const short yydefgoto[] = { 37,
2, 3, 13, 14, 9, 23, 25, 26
};
static const short yypact[] = { 2,
6, 2,-32768, 8,-32768, 7, 10,-32768, 9, 11,
12, 10, -5,-32768, -3, 12, 13, 14,-32768,-32768,
-32768, 17, 1,-32768, 15, 18, 14,-32768,-32768, 17,
3,-32768, 14,-32768, 16,-32768, 25, 26,-32768
};
static const short yypgoto[] = {-32768,
-32768, 27,-32768, 19, 20, -27, -12,-32768
};
#define YYLAST 35
static const short yytable[] = { 31,
16, 17, 18, 19, 1, 35, 27, 28, 33, 34,
4, 6, 7, 8, 10, 11, 12, 32, 22, 21,
24, 29, 36, 30, 38, 39, 0, 0, 5, 0,
0, 15, 0, 0, 20
};
static const short yycheck[] = { 27,
6, 7, 6, 7, 3, 33, 6, 7, 6, 7,
5, 4, 6, 4, 6, 5, 5, 30, 5, 7,
4, 7, 7, 6, 0, 0, -1, -1, 2, -1,
-1, 12, -1, -1, 16
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/local/share/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
#pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */
#endif /* not GNU C. */
#endif /* alloca not defined. */
/* This is the parser code that is written into each bison parser
when the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
as one case of the switch. */
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT return(0)
#define YYABORT return(1)
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(token, value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#ifndef YYPURE
#define YYLEX yylex()
#endif
#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif
/* If nonreentrant, generate the variables here */
#ifndef YYPURE
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
#ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
#endif
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
#if YYDEBUG != 0
int yydebug; /* nonzero means print parse trace */
/* Since this is uninitialized, it does not stop multiple parsers
from coexisting. */
#endif
/* YYINITDEPTH indicates the initial size of the parser's stacks */
#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif
/* YYMAXDEPTH is the maximum size the stacks can grow to
(effective only if the built-in stack extension method is used). */
#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
int yyparse (void);
#endif
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
#ifndef __cplusplus
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_memcpy (from, to, count)
char *from;
char *to;
int count;
{
register char *f = from;
register char *t = to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
#else /* __cplusplus */
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_memcpy (char *from, char *to, int count)
{
register char *f = from;
register char *t = to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
#endif
#endif
#line 192 "/usr/local/share/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
It should actually point to an object.
Grammar actions can access the variable by casting it
to the proper pointer type. */
#ifdef YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#else
#define YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#endif
int
yyparse(YYPARSE_PARAM)
YYPARSE_PARAM_DECL
{
register int yystate;
register int yyn;
register short *yyssp;
register YYSTYPE *yyvsp;
int yyerrstatus; /* number of tokens to shift before error messages enabled */
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
short yyssa[YYINITDEPTH]; /* the state stack */
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
#ifdef YYLSP_NEEDED
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK (yyvsp--, yyssp--)
#endif
int yystacksize = YYINITDEPTH;
#ifdef YYPURE
int yychar;
YYSTYPE yylval;
int yynerrs;
#ifdef YYLSP_NEEDED
YYLTYPE yylloc;
#endif
#endif
YYSTYPE yyval; /* the variable used to return */
/* semantic values from the action */
/* routines */
int yylen;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Starting parse\n");
#endif
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss - 1;
yyvsp = yyvs;
#ifdef YYLSP_NEEDED
yylsp = yyls;
#endif
/* Push a new state, which is found in yystate . */
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks. */
yynewstate:
*++yyssp = yystate;
if (yyssp >= yyss + yystacksize - 1)
{
/* Give user a chance to reallocate the stack */
/* Use copies of these so that the &'s don't force the real ones into memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
YYLTYPE *yyls1 = yyls;
#endif
/* Get the current used size of the three stacks, in elements. */
int size = yyssp - yyss + 1;
#ifdef yyoverflow
/* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */
#ifdef YYLSP_NEEDED
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yyls1, size * sizeof (*yylsp),
&yystacksize);
#else
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yystacksize);
#endif
yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
yyls = yyls1;
#endif
#else /* no yyoverflow */
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
{
yyerror("parser stack overflow");
return 2;
}
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
__yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
__yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */
yyssp = yyss + size - 1;
yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
yylsp = yyls + size - 1;
#endif
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Entering state %d\n", yystate);
#endif
goto yybackup;
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF
or a valid token in external form. */
if (yychar == YYEMPTY)
{
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Reading a token: ");
#endif
yychar = YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
{
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Now at end of input.\n");
#endif
}
else
{
yychar1 = YYTRANSLATE(yychar);
#if YYDEBUG != 0
if (yydebug)
{
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise meaning
of a token, for further debugging info. */
#ifdef YYPRINT
YYPRINT (stderr, yychar, yylval);
#endif
fprintf (stderr, ")\n");
}
#endif
}
yyn += yychar1;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
goto yydefault;
yyn = yytable[yyn];
/* yyn is what to do for this token type in this state.
Negative => reduce, -yyn is rule number.
Positive => shift, yyn is new state.
New state is final state => don't bother to shift,
just return success.
0, or most negative number => error. */
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
/* count tokens shifted since error; after three, turn off error status. */
if (yyerrstatus) yyerrstatus--;
yystate = yyn;
goto yynewstate;
/* Do the default action for the current state. */
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
/* Do a reduction. yyn is the number of a rule to reduce with. */
yyreduce:
yylen = yyr2[yyn];
if (yylen > 0)
yyval = yyvsp[1-yylen]; /* implement default value of the action */
#if YYDEBUG != 0
if (yydebug)
{
int i;
fprintf (stderr, "Reducing via rule %d (line %d), ",
yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
switch (yyn) {
case 1:
#line 62 "bi-parser.y"
{ defs = yyvsp[0].def; ;
break;}
case 3:
#line 68 "bi-parser.y"
{ yyvsp[0].def->next = yyvsp[-1].def; yyval.def = yyvsp[0].def; ;
break;}
case 4:
#line 73 "bi-parser.y"
{ yyval.def = makedef (yyvsp[-7].string, yyvsp[-5].string, yyvsp[-2].variation); ;
break;}
case 6:
#line 79 "bi-parser.y"
{ yyvsp[0].variation->next = yyvsp[-2].variation; yyval.variation = yyvsp[0].variation; ;
break;}
case 7:
#line 84 "bi-parser.y"
{ yyval.variation = makevar (yyvsp[-1].string, (struct node *) NULL, (struct node *) NULL, (struct node *) NULL); ;
break;}
case 8:
#line 86 "bi-parser.y"
{ yyval.variation = makevar (yyvsp[-3].string, yyvsp[-1].node, (struct node *) NULL, (struct node *) NULL); ;
break;}
case 9:
#line 88 "bi-parser.y"
{ yyval.variation = makevar (yyvsp[-5].string, yyvsp[-3].node, yyvsp[-1].node, (struct node *) NULL); ;
break;}
case 10:
#line 90 "bi-parser.y"
{ yyval.variation = makevar (yyvsp[-7].string, yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].node); ;
break;}
case 11:
#line 94 "bi-parser.y"
{ yyval.string = ""; ;
break;}
case 12:
#line 95 "bi-parser.y"
{ yyval.string = yyvsp[0].string; ;
break;}
case 13:
#line 100 "bi-parser.y"
{ yyval.node = yyvsp[-1].node; ;
break;}
case 14:
#line 102 "bi-parser.y"
{ yyval.node = NULL; ;
break;}
case 16:
#line 109 "bi-parser.y"
{ yyvsp[-2].node->next = yyvsp[0].node; yyval.node = yyvsp[-2].node; ;
break;}
case 17:
#line 114 "bi-parser.y"
{ yyval.node = makenode (yyvsp[0].string); ;
break;}
}
/* the action file gets copied in in place of this dollarsign */
#line 487 "/usr/local/share/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
#ifdef YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
*++yyvsp = yyval;
#ifdef YYLSP_NEEDED
yylsp++;
if (yylen == 0)
{
yylsp->first_line = yylloc.first_line;
yylsp->first_column = yylloc.first_column;
yylsp->last_line = (yylsp-1)->last_line;
yylsp->last_column = (yylsp-1)->last_column;
yylsp->text = 0;
}
else
{
yylsp->last_line = (yylsp+yylen-1)->last_line;
yylsp->last_column = (yylsp+yylen-1)->last_column;
}
#endif
/* Now "shift" the result of the reduction.
Determine what state that goes to,
based on the state we popped back to
and the rule number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
yyerrlab: /* here on detecting error */
if (! yyerrstatus)
/* If not already recovering from an error, report this error. */
{
++yynerrs;
#ifdef YYERROR_VERBOSE
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
int size = 0;
char *msg;
int x, count;
count = 0;
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen(yytname[x]) + 15, count++;
msg = (char *) malloc(size + 15);
if (msg != 0)
{
strcpy(msg, "parse error");
if (count < 5)
{
count = 0;
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
{
strcat(msg, count == 0 ? ", expecting `" : " or `");
strcat(msg, yytname[x]);
strcat(msg, "'");
count++;
}
}
yyerror(msg);
free(msg);
}
else
yyerror ("parse error; also virtual memory exceeded");
}
else
#endif /* YYERROR_VERBOSE */
yyerror("parse error");
}
goto yyerrlab1;
yyerrlab1: /* here on error raised explicitly by an action */
if (yyerrstatus == 3)
{
/* if just tried and failed to reuse lookahead token after an error, discard it. */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token
after shifting the error token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
yyerrdefault: /* current state does not do anything special for the error token. */
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
if (yyn) goto yydefault;
#endif
yyerrpop: /* pop the current state because it cannot handle the error token */
if (yyssp == yyss) YYABORT;
yyvsp--;
yystate = *--yyssp;
#ifdef YYLSP_NEEDED
yylsp--;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "Error: state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
yyerrhandle:
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yyerrdefault;
yyn += YYTERROR;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
goto yyerrdefault;
yyn = yytable[yyn];
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrpop;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrpop;
if (yyn == YYFINAL)
YYACCEPT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting error token, ");
#endif
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
yystate = yyn;
goto yynewstate;
}
#line 117 "bi-parser.y"
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);
}

View File

@ -1,12 +0,0 @@
typedef union
{
char *string;
struct def *def;
struct variation *variation;
struct node *node;
} YYSTYPE;
#define DEFOP 258
#define STRING 259
extern YYSTYPE yylval;

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -53,23 +53,7 @@ Boston, MA 02111-1307, USA. */
#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"
/* Opcode names */
#ifdef BCDEBUG_PRINT_CODE
char *opcode_name[] =
{
#include "bc-opname.h"
"***END***"
};
#endif
/* Commonly used modes. */
@ -1451,11 +1435,8 @@ gen_label_rtx ()
{
register rtx label;
label = (output_bytecode
? gen_rtx_CODE_LABEL (VOIDmode, 0, bc_get_bytecode_label (),
NULL_RTX, 0, NULL_PTR)
: gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX,
NULL_RTX, label_num++, NULL_PTR));
label = gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX,
NULL_RTX, label_num++, NULL_PTR);
LABEL_NUSES (label) = 0;
return label;
@ -2937,13 +2918,6 @@ 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;

1323
gcc/expr.c

File diff suppressed because it is too large Load Diff

View File

@ -936,19 +936,7 @@ extern rtx (*lang_expand_expr) PROTO ((union tree_node *, rtx,
enum machine_mode,
enum expand_modifier modifier));
#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
extern void init_all_optabs PROTO ((void));
extern void init_mov_optab PROTO ((void));
extern void bc_adjust_stack PROTO ((int));
extern void bc_load_localaddr PROTO ((rtx));
extern void do_jump_by_parts_greater_rtx PROTO ((enum machine_mode, int,
rtx, rtx, rtx, rtx));

View File

@ -55,8 +55,6 @@ Boston, MA 02111-1307, USA. */
#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
@ -388,19 +386,12 @@ 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;
@ -1312,9 +1303,6 @@ put_var_into_stack (decl)
tree context;
int can_use_addressof;
if (output_bytecode)
return;
context = decl_function_context (decl);
/* Get the current rtl used for this object and it's original mode. */
@ -5153,50 +5141,6 @@ all_blocks (block, vector)
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. */
@ -5207,17 +5151,6 @@ init_function_start (subr, filename, line)
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;
@ -5371,99 +5304,14 @@ mark_varargs ()
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);
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.
@ -5479,12 +5327,6 @@ expand_function_start (subr, parms_have_cleanups)
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 ();
@ -5719,12 +5561,6 @@ expand_function_end (filename, line, end_bindings)
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. */

View File

@ -35,7 +35,6 @@ Boston, MA 02111-1307, USA. */
#include "real.h"
#include "except.h"
#include "function.h"
#include "bytecode.h"
#include "obstack.h"
#define obstack_chunk_alloc xmalloc
@ -3273,12 +3272,6 @@ output_inline_function (fndecl)
rtx head;
rtx last;
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 ();

View File

@ -56,20 +56,20 @@ extern void shorten_branches PROTO((rtx));
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));
extern void final_start_function 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));
extern void final_end_function 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));
extern void final 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));
extern rtx final_scan_insn PROTO((rtx, FILE *, int, int, int));
/* Replace a SUBREG with a REG or a MEM, based on the thing it is a
subreg of. */
@ -93,12 +93,11 @@ 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));
extern void output_addr_const 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, ...)));
extern void asm_fprintf PROTO(PVPROTO((FILE *file, char *p, ...)));
/* Split up a CONST_DOUBLE or integer constant rtx into two rtx's for single
words. */
@ -119,8 +118,8 @@ extern void leaf_renumber_regs_insn PROTO((rtx));
extern void allocate_for_life_analysis PROTO((void));
extern int regno_uninitialized PROTO((int));
extern int regno_clobbered_at_setjmp PROTO((int));
extern void dump_flow_info STDIO_PROTO((FILE *));
extern void flow_analysis STDIO_PROTO((rtx, int, FILE *));
extern void dump_flow_info PROTO((FILE *));
extern void flow_analysis PROTO((rtx, int, FILE *));
#endif
/* Functions in varasm.c. */
@ -229,12 +228,6 @@ extern void assemble_string PROTO((char *, int));
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. */
@ -257,7 +250,7 @@ extern void assemble_label PROTO((char *));
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 *));
extern void assemble_name PROTO((FILE *, char *));
#ifdef RTX_CODE
/* Assemble the integer constant X into an object of SIZE bytes.

View File

@ -34,7 +34,6 @@ Boston, MA 02111-1307, USA. */
#include "recog.h"
#include "reload.h"
#include "real.h"
#include "bytecode.h"
#ifndef REGISTER_MOVE_COST
#define REGISTER_MOVE_COST(x, y) 2
@ -424,8 +423,7 @@ 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_sets_1 ();
init_reg_modes ();
}
@ -483,13 +481,6 @@ fix_register (name, 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. */

View File

@ -439,17 +439,6 @@ extern char *note_insn_name[];
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) (XSTR ((X), 0))
/* For goto labels inside bytecode functions. */
#define BYTECODE_BC_LABEL(X) (*(struct bc_label **) &XEXP ((X), 1))
/* The original regno this ADDRESSOF was built for. */
#define ADDRESSOF_REGNO(RTX) ((RTX)->fld[1].rtint)
@ -681,10 +670,6 @@ extern int ceil_log2 PROTO((unsigned HOST_WIDE_INT));
extern rtx plus_constant_wide PROTO((rtx, HOST_WIDE_INT));
extern rtx plus_constant_for_output_wide PROTO((rtx, HOST_WIDE_INT));
struct bc_label;
extern rtx bc_gen_rtx PROTO ((char *, int,
struct bc_label *));
extern rtx gen_rtx PVPROTO((enum rtx_code,
enum machine_mode, ...));
extern rtvec gen_rtvec PVPROTO((int, ...));
@ -1254,7 +1239,6 @@ extern void emit_jump PROTO ((rtx));
extern int preserve_subexpressions_p PROTO ((void));
/* In expr.c */
extern rtx bc_allocate_local PROTO ((int, int));
extern void init_expr_once PROTO ((void));
/* In stupid.c */

File diff suppressed because it is too large Load Diff

View File

@ -72,8 +72,6 @@ Boston, MA 02111-1307, USA. */
#include "insn-attr.h"
#include "defaults.h"
#include "output.h"
#include "bytecode.h"
#include "bc-emit.h"
#include "except.h"
#ifdef XCOFF_DEBUGGING_INFO
@ -306,9 +304,6 @@ 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:
@ -751,7 +746,6 @@ struct { char *string; int *variable; int on_value;} f_options[] =
{"regmove", &flag_regmove, 1},
{"pack-struct", &flag_pack_struct, 1},
{"stack-check", &flag_stack_check, 1},
{"bytecode", &output_bytecode, 1},
{"argument-alias", &flag_argument_noalias, 0},
{"argument-noalias", &flag_argument_noalias, 1},
{"argument-noalias-global", &flag_argument_noalias, 2},
@ -1111,11 +1105,8 @@ fatal_insn (message, insn)
char *message;
rtx insn;
{
if (!output_bytecode)
{
error (message);
debug_rtx (insn);
}
error (message);
debug_rtx (insn);
if (asm_out_file)
fflush (asm_out_file);
if (aux_info_file)
@ -2262,8 +2253,6 @@ compile_file (name)
#else
init_lex ();
#endif
/* 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
@ -2431,36 +2420,27 @@ compile_file (name)
if (main_input_filename == 0)
main_input_filename = name;
if (!output_bytecode)
{
ASM_FILE_START (asm_out_file);
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
if (flag_verbose_asm)
{
#ifndef ASM_IDENTIFY_GCC
fprintf (asm_out_file, "gcc2_compiled.:\n");
#else
ASM_IDENTIFY_GCC (asm_out_file);
#endif
/* 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. */
#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
@ -2485,28 +2465,20 @@ compile_file (name)
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. */
/* ??? 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);
}
/* 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. */
@ -2535,8 +2507,7 @@ compile_file (name)
/* Initialize yet another pass. */
if (!output_bytecode)
init_final (main_input_filename);
init_final (main_input_filename);
init_branch_prob (dump_base_name);
start_time = get_run_time ();
@ -2792,23 +2763,17 @@ compile_file (name)
/* Output some stuff at end of file if nec. */
if (!output_bytecode)
{
end_final (dump_base_name);
end_branch_prob (branch_prob_dump_file);
end_final (dump_base_name);
end_branch_prob (branch_prob_dump_file);
#ifdef ASM_FILE_END
ASM_FILE_END (asm_out_file);
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)
@ -2893,29 +2858,26 @@ compile_file (name)
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-prob", branch_prob_time);
print_time ("flow", flow_time);
print_time ("combine", combine_time);
print_time ("regmove", regmove_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);
}
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-prob", branch_prob_time);
print_time ("flow", flow_time);
print_time ("combine", combine_time);
print_time ("regmove", regmove_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);
}
}
@ -2966,8 +2928,7 @@ rest_of_decl_compilation (decl, asmspec, top_level, at_end)
&& (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)
if (decl == last_assemble_variable_decl)
{
ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
top_level, at_end);
@ -3033,9 +2994,6 @@ rest_of_compilation (decl)
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. */
@ -4392,18 +4350,6 @@ main (argc, argv, envp)
if (flag_check_memory_usage)
flag_omit_frame_pointer = 0;
/* 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,

View File

@ -1964,8 +1964,6 @@ extern tree reorder_blocks PROTO ((tree *, tree,
extern void free_temps_for_rtl_expr PROTO ((tree));
extern void instantiate_virtual_regs PROTO ((tree, struct rtx_def *));
extern int max_parm_reg_num PROTO ((void));
extern void bc_expand_function_start PROTO ((tree, int));
extern void bc_expand_function_end PROTO ((void));
extern void push_function_context PROTO ((void));
extern void pop_function_context PROTO ((void));
extern void push_function_context_to PROTO ((tree));
@ -1987,8 +1985,6 @@ extern void indent_to PROTO ((FILE *, int));
/* In expr.c */
extern void emit_queue PROTO ((void));
extern int apply_args_register_offset PROTO ((int));
extern char * bc_gen_constr_label PROTO ((void));
extern struct rtx_def *bc_allocate_variable_array PROTO ((tree));
extern struct rtx_def *expand_builtin_return_addr
PROTO ((enum built_in_function, int, struct rtx_def *));
extern void do_pending_stack_adjust PROTO ((void));

View File

@ -41,7 +41,6 @@ Boston, MA 02111-1307, USA. */
#include "regs.h"
#include "defaults.h"
#include "real.h"
#include "bytecode.h"
#include "obstack.h"
#include "c-pragma.h"
@ -138,9 +137,7 @@ 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));
@ -163,7 +160,6 @@ 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
@ -198,11 +194,7 @@ text_section ()
{
if (in_section != in_text)
{
if (output_bytecode)
bc_text ();
else
fprintf (asm_out_file, "%s\n", TEXT_SECTION_ASM_OP);
fprintf (asm_out_file, "%s\n", TEXT_SECTION_ASM_OP);
in_section = in_text;
}
}
@ -214,21 +206,16 @@ data_section ()
{
if (in_section != in_data)
{
if (output_bytecode)
bc_data ();
else
if (flag_shared_data)
{
if (flag_shared_data)
{
#ifdef SHARED_SECTION_ASM_OP
fprintf (asm_out_file, "%s\n", 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);
fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP);
#endif
}
else
fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP);
}
else
fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP);
in_section = in_data;
}
@ -329,17 +316,12 @@ 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
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);
}
fprintf (asm_out_file, "%s\n", BSS_SECTION_ASM_OP);
in_section = in_bss;
}
@ -501,16 +483,6 @@ make_function_rtl (decl)
char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
char *new_name = name;
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
@ -556,47 +528,6 @@ make_function_rtl (decl)
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 && !TREE_PUBLIC (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 *
@ -689,12 +620,6 @@ make_decl_rtl (decl, asmspec, 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)
@ -889,12 +814,6 @@ 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)
@ -1025,12 +944,7 @@ assemble_start_function (decl, fnname)
/* 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);
}
ASM_OUTPUT_ALIGN (asm_out_file, align);
#ifdef ASM_OUTPUT_FUNCTION_PREFIX
ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname);
@ -1067,24 +981,16 @@ assemble_start_function (decl, fnname)
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);
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);
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);
/* 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
@ -1114,12 +1020,6 @@ 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. */
@ -1153,12 +1053,7 @@ assemble_zeros (size)
else
#endif
if (size > 0)
{
if (output_bytecode)
BC_OUTPUT_SKIP (asm_out_file, size);
else
ASM_OUTPUT_SKIP (asm_out_file, size);
}
ASM_OUTPUT_SKIP (asm_out_file, size);
}
/* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
@ -1182,12 +1077,6 @@ assemble_string (p, size)
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)
@ -1196,26 +1085,13 @@ assemble_string (p, size)
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);
}
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.
@ -1242,9 +1118,6 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
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
@ -1254,22 +1127,19 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
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);
/* 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);
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
@ -1422,11 +1292,6 @@ assemble_variable (decl, top_level, at_end, dont_output_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_DECL_COMMON
ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, decl, name, size,
@ -1449,11 +1314,6 @@ assemble_variable (decl, top_level, at_end, dont_output_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,
@ -1471,11 +1331,6 @@ assemble_variable (decl, top_level, at_end, dont_output_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_DECL_LOCAL
ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, decl, name, size,
@ -1601,26 +1456,16 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
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));
}
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);
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);
/* 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)
{
@ -1693,55 +1538,6 @@ contains_pointers_p (type)
}
}
/* 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. */
@ -1750,9 +1546,6 @@ 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))
@ -1777,14 +1570,11 @@ 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))
{
/* 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);
}
SYMBOL_REF_USED (fun) = 1;
ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
}
#endif
}
@ -1804,10 +1594,7 @@ void
assemble_label (name)
char *name;
{
if (output_bytecode)
BC_OUTPUT_LABEL (asm_out_file, name);
else
ASM_OUTPUT_LABEL (asm_out_file, name);
ASM_OUTPUT_LABEL (asm_out_file, name);
}
/* Output to FILE a reference to the assembler name of a C-level name NAME.
@ -1834,19 +1621,9 @@ assemble_name (file, name)
TREE_SYMBOL_REFERENCED (id) = 1;
if (name[0] == '*')
{
if (output_bytecode)
bc_emit_labelref (name, 0);
else
fputs (&name[1], file);
}
fputs (&name[1], file);
else
{
if (output_bytecode)
BC_OUTPUT_LABELREF (file, name);
else
ASM_OUTPUT_LABELREF (file, name);
}
ASM_OUTPUT_LABELREF (file, name);
}
/* Allocate SIZE bytes writable static space with a gensym name
@ -1877,28 +1654,18 @@ assemble_static_space (size)
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);
x = gen_rtx_SYMBOL_REF (Pmode, namestring);
if (output_bytecode)
{
BC_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
}
else
{
#ifdef ASM_OUTPUT_ALIGNED_DECL_LOCAL
ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, NULL_TREE, name, size,
BIGGEST_ALIGNMENT);
ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, NULL_TREE, name, size,
BIGGEST_ALIGNMENT);
#else
#ifdef ASM_OUTPUT_ALIGNED_LOCAL
ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, BIGGEST_ALIGNMENT);
ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, BIGGEST_ALIGNMENT);
#else
ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
#endif
#endif
}
return x;
}
@ -1914,10 +1681,6 @@ assemble_trampoline_template ()
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
@ -2385,13 +2148,9 @@ decode_addr_const (exp, value)
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))));
x = gen_rtx_MEM (FUNCTION_MODE,
gen_rtx_LABEL_REF (VOIDmode,
label_rtx (TREE_OPERAND (exp, 0))));
break;
case REAL_CST:
@ -2406,12 +2165,9 @@ decode_addr_const (exp, value)
abort ();
}
if (!output_bytecode)
{
if (GET_CODE (x) != MEM)
abort ();
x = XEXP (x, 0);
}
if (GET_CODE (x) != MEM)
abort ();
x = XEXP (x, 0);
value->base = x;
value->offset = offset;
@ -3179,16 +2935,7 @@ output_constant_def_contents (exp, reloc, labelno)
#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));
}
}
ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
/* Output the label itself. */
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", labelno);
@ -3994,10 +3741,7 @@ output_constant (exp, size)
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);
assemble_zeros (size);
return;
}
@ -4091,107 +3835,6 @@ output_constant (exp, size)
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).
@ -4299,10 +3942,7 @@ output_constructor (exp, size)
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);
assemble_zeros (bitpos - total_bytes);
total_bytes = bitpos;
}
@ -4563,9 +4203,6 @@ assemble_alias (decl, target)
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);
}