Commit ca695ac9 by Jan Brittenson

bytecode

From-SVN: r5379
parent 86d7f2db
...@@ -399,6 +399,9 @@ CPLUS_OBJS = cp-parse.o cp-decl.o cp-decl2.o \ ...@@ -399,6 +399,9 @@ CPLUS_OBJS = cp-parse.o cp-decl.o cp-decl2.o \
cp-expr.o cp-pt.o cp-edsel.o cp-xref.o \ cp-expr.o cp-pt.o cp-edsel.o cp-xref.o \
$(CPLUS_INPUT) cp-spew.o c-common.o $(CPLUS_INPUT) cp-spew.o c-common.o
# Files specific to the C interpreter bytecode compiler(s).
BC_OBJS = bc-emit.o bc-optab.o
# Language-independent object files. # Language-independent object files.
OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \ OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
function.o stmt.o expr.o calls.o expmed.o explow.o optabs.o varasm.o \ function.o stmt.o expr.o calls.o expmed.o explow.o optabs.o varasm.o \
...@@ -461,6 +464,7 @@ CONFIG_H = ...@@ -461,6 +464,7 @@ CONFIG_H =
RTL_H = rtl.h rtl.def machmode.h machmode.def RTL_H = rtl.h rtl.def machmode.h machmode.def
TREE_H = tree.h real.h tree.def machmode.h machmode.def TREE_H = tree.h real.h tree.def machmode.h machmode.def
CPLUS_TREE_H = $(TREE_H) cp-tree.h cp-tree.def CPLUS_TREE_H = $(TREE_H) cp-tree.h cp-tree.def
BYTECODE_H = bytecode.h bc-emit.h bc-optab.h
# Avoid a lot of time thinking about remaking Makefile.in and *.def. # Avoid a lot of time thinking about remaking Makefile.in and *.def.
.SUFFIXES: .in .def .SUFFIXES: .in .def
...@@ -484,7 +488,7 @@ for-bootstrap: start.encap $(LIBGCC) ...@@ -484,7 +488,7 @@ for-bootstrap: start.encap $(LIBGCC)
rest.encap: $(LIBGCC) stmp-headers $(STMP_FIXPROTO) $(EXTRA_PARTS) rest.encap: $(LIBGCC) stmp-headers $(STMP_FIXPROTO) $(EXTRA_PARTS)
# This is what is made with the host's compiler # This is what is made with the host's compiler
# whether making a cross compiler or not. # whether making a cross compiler or not.
native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) native: bytecode config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
# Define the names for selecting languages in LANGUAGES. # Define the names for selecting languages in LANGUAGES.
C c: cc1 C c: cc1
...@@ -545,14 +549,14 @@ g++-cross: $(srcdir)/g++.c ...@@ -545,14 +549,14 @@ g++-cross: $(srcdir)/g++.c
$(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \ $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \
-DGCC_NAME=\"$(target)-gcc\" $(srcdir)/g++.c version.o $(LIBS) -DGCC_NAME=\"$(target)-gcc\" $(srcdir)/g++.c version.o $(LIBS)
cc1:$(P) $(C_OBJS) $(OBJS) $(LIBDEPS) cc1:$(P) $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(LIBS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
cc1plus:$(P) $(CPLUS_OBJS) $(OBJS) $(LIBDEPS) cc1plus:$(P) $(CPLUS_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(OBJS) $(LIBS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(BC_OBJS) $(OBJS) $(LIBS)
cc1obj:$(P) $(OBJC_OBJS) $(OBJS) $(LIBDEPS) cc1obj:$(P) $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1obj $(OBJC_OBJS) $(OBJS) $(LIBS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1obj $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
# Copy float.h from its source. # Copy float.h from its source.
gfloat.h: $(FLOAT_H) gfloat.h: $(FLOAT_H)
...@@ -1247,6 +1251,63 @@ $(HOST_PREFIX_1)malloc.o: malloc.c ...@@ -1247,6 +1251,63 @@ $(HOST_PREFIX_1)malloc.o: malloc.c
$(HOST_PREFIX_1): $(HOST_PREFIX_1):
touch $(HOST_PREFIX_1) touch $(HOST_PREFIX_1)
# Remake bytecode files.
# BI_ALL=bi-run.o
BI_ALL=
BC_ALL=bc-opname.h bc-opcode.h bc-arity.h
BI_OBJ=bi-parser.o bi-lexer.o bi-reverse.o
bc-emit.o : bc-emit.c $(CONFIG_H) $(BYTECODE_H)
bc-optab.o : bc-optab.c bc-typecd.def $(CONFIG_H) $(BYTECODE_H)
bytecode: $(BI_ALL) $(BC_ALL)
bi-arity: bi-arity.o
bi-opcode: bi-opcode.o
bi-opname: bi-opname.o
bi-unparse: bi-unparse.o
bi-lexer: bi-lexer.o
bi-arity bi-opcode bi-opname bi-unparse bi-lexer: $(BI_OBJ)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $^ $(LEXLIB)
bi-run.o: $(srcdir)/bi-run.c $(srcdir)/bi-run.h $(srcdir)/bc-typecd.h bc-opname.h bc-arity.h bc-opcode.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $<
bi-parser.c: $(srcdir)/bi-parser.y $(srcdir)/bi-parser.h
bi-parser.o: $(srcdir)/bi-parser.c $(srcdir)/bi-defs.h
$(CC) $(CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $<
bi-lexer.c: $(srcdir)/bi-lexer.l $(srcdir)/bi-parser.h
bi-lexer.o: bi-lexer.c bi-parser.h
$(CC) $(CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $<
bc-arity.h: $(srcdir)/bytecode.def bi-arity
-rm -f $@
bi-arity <$< >$@
bc-opcode.h: $(srcdir)/bytecode.def bi-opcode
-rm -f $@
bi-opcode <$< >$@
bc-opname.h: $(srcdir)/bytecode.def bi-opname
-rm -f $@
bi-opname <$< >$@
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-unparse bi-lexer
bytecode.realclean: bytecode.clean
-rm -f bi-parser.c bi-lexer.c bi-parser.h
# Remake cpp and protoize. # Remake cpp and protoize.
# Making the preprocessor # Making the preprocessor
...@@ -1507,7 +1568,7 @@ $(srcdir)/INSTALL: install1.texi install.texi ...@@ -1507,7 +1568,7 @@ $(srcdir)/INSTALL: install1.texi install.texi
# `realclean' also deletes everything that could be regenerated automatically. # `realclean' also deletes everything that could be regenerated automatically.
mostlyclean: mostlyclean: bytecode.mostlyclean
-rm -f $(STAGESTUFF) -rm -f $(STAGESTUFF)
# Clean the objc subdir if we created one. # Clean the objc subdir if we created one.
if [ -d objc ]; then \ if [ -d objc ]; then \
...@@ -1545,7 +1606,7 @@ mostlyclean: ...@@ -1545,7 +1606,7 @@ mostlyclean:
# Delete all files made by compilation # Delete all files made by compilation
# that don't exist in the distribution. # that don't exist in the distribution.
clean: mostlyclean clean: mostlyclean bytecode.clean
# It may not be quite desirable to delete unprotoize.c here, # It may not be quite desirable to delete unprotoize.c here,
# but the spec for `make clean' requires it. # but the spec for `make clean' requires it.
# Using unprotoize.c is not quite right in the first place, # Using unprotoize.c is not quite right in the first place,
...@@ -1557,7 +1618,7 @@ clean: mostlyclean ...@@ -1557,7 +1618,7 @@ clean: mostlyclean
# Delete all files that users would normally create # Delete all files that users would normally create
# while building and installing GCC. # while building and installing GCC.
distclean: clean distclean: clean bytecode.distclean
-rm -f tm.h aux-output.c config.h md config.status tconfig.h hconfig.h -rm -f tm.h aux-output.c config.h md config.status tconfig.h hconfig.h
-rm -f Makefile *.oaux -rm -f Makefile *.oaux
-rm -fr stage1 stage2 stage3 stage4 -rm -fr stage1 stage2 stage3 stage4
...@@ -1581,7 +1642,7 @@ extraclean: distclean ...@@ -1581,7 +1642,7 @@ extraclean: distclean
# Get rid of every file that's generated from some other file. # Get rid of every file that's generated from some other file.
# Most of these files ARE PRESENT in the GCC distribution. # Most of these files ARE PRESENT in the GCC distribution.
realclean: distclean realclean: distclean bytecode.realclean
-rm -f c-parse.y objc-parse.y -rm -f c-parse.y objc-parse.y
-rm -f cp-parse.c cp-parse.h cp-parse.output -rm -f cp-parse.c cp-parse.h cp-parse.output
-rm -f objc-parse.c objc-parse.output -rm -f objc-parse.c objc-parse.output
......
...@@ -20,6 +20,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -20,6 +20,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h> #include <stdio.h>
#include "config.h" #include "config.h"
#include "tree.h" #include "tree.h"
#include "function.h"
#ifdef HANDLE_SYSV_PRAGMA #ifdef HANDLE_SYSV_PRAGMA
...@@ -45,20 +46,7 @@ handle_pragma_token (string, token) ...@@ -45,20 +46,7 @@ handle_pragma_token (string, token)
char *string; char *string;
tree token; tree token;
{ {
static enum pragma_state static enum pragma_state state = ps_start, type;
{
ps_start,
ps_done,
ps_bad,
ps_weak,
ps_name,
ps_equals,
ps_value,
ps_pack,
ps_left,
ps_align,
ps_right
} state = ps_start, type;
static char *name; static char *name;
static char *value; static char *value;
static int align; static int align;
...@@ -76,24 +64,8 @@ handle_pragma_token (string, token) ...@@ -76,24 +64,8 @@ handle_pragma_token (string, token)
{ {
#ifdef HANDLE_PRAGMA_WEAK #ifdef HANDLE_PRAGMA_WEAK
if (HANDLE_PRAGMA_WEAK) if (HANDLE_PRAGMA_WEAK)
{ handle_pragma_weak (state, asm_out_file, name, value);
if (state == ps_name || state == ps_value)
{
fprintf (asm_out_file, "\t%s\t", WEAK_ASM_OP);
ASM_OUTPUT_LABELREF (asm_out_file, name);
fputc ('\n', asm_out_file);
if (state == ps_value)
{
fprintf (asm_out_file, "\t%s\t", SET_ASM_OP);
ASM_OUTPUT_LABELREF (asm_out_file, name);
fputc (',', asm_out_file);
ASM_OUTPUT_LABELREF (asm_out_file, value);
fputc ('\n', asm_out_file);
}
}
else if (! (state == ps_done || state == ps_start))
warning ("malformed `#pragma weak'");
}
#endif /* HANDLE_PRAMA_WEAK */ #endif /* HANDLE_PRAMA_WEAK */
} }
......
...@@ -42,8 +42,29 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -42,8 +42,29 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "regs.h" #include "regs.h"
#include "insn-config.h" #include "insn-config.h"
#include "real.h" #include "real.h"
#include "obstack.h"
#include "bytecode.h"
#include "machmode.h"
#include "bc-opcode.h"
#include "bc-typecd.h"
#include "bc-optab.h"
#include "bc-emit.h"
#include <stdio.h> #include <stdio.h>
/* Opcode names */
#ifdef BCDEBUG_PRINT_CODE
char *opcode_name[] =
{
#include "bc-opname.h"
"***END***"
};
#endif
/* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function. /* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function.
After rtl generation, it is 1 plus the largest register number used. */ After rtl generation, it is 1 plus the largest register number used. */
...@@ -203,6 +224,11 @@ extern int emit_lineno; ...@@ -203,6 +224,11 @@ extern int emit_lineno;
rtx change_address (); rtx change_address ();
void init_emit (); void init_emit ();
extern struct obstack *rtl_obstack;
extern int stack_depth;
extern int max_stack_depth;
/* rtx gen_rtx (code, mode, [element1, ..., elementn]) /* rtx gen_rtx (code, mode, [element1, ..., elementn])
** **
** This routine generates an RTX of the size specified by ** This routine generates an RTX of the size specified by
...@@ -1216,8 +1242,12 @@ change_address (memref, mode, addr) ...@@ -1216,8 +1242,12 @@ change_address (memref, mode, addr)
rtx rtx
gen_label_rtx () gen_label_rtx ()
{ {
register rtx label = gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0, register rtx label;
label_num++, NULL_PTR);
label = output_bytecode
? bc_gen_rtx (0, 0, bc_get_bytecode_label ())
: gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0, label_num++, NULL_PTR);
LABEL_NUSES (label) = 0; LABEL_NUSES (label) = 0;
return label; return label;
} }
...@@ -2559,6 +2589,13 @@ emit_line_note (file, line) ...@@ -2559,6 +2589,13 @@ emit_line_note (file, line)
char *file; char *file;
int line; 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_filename = file;
emit_lineno = line; emit_lineno = line;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -32,6 +32,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -32,6 +32,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "integrate.h" #include "integrate.h"
#include "real.h" #include "real.h"
#include "function.h" #include "function.h"
#include "bytecode.h"
#include "obstack.h" #include "obstack.h"
#define obstack_chunk_alloc xmalloc #define obstack_chunk_alloc xmalloc
...@@ -2850,9 +2851,16 @@ void ...@@ -2850,9 +2851,16 @@ void
output_inline_function (fndecl) output_inline_function (fndecl)
tree fndecl; tree fndecl;
{ {
rtx head = DECL_SAVED_INSNS (fndecl); rtx head;
rtx last; rtx last;
if (output_bytecode)
{
warning ("`inline' ignored for bytecode output");
return;
}
head = DECL_SAVED_INSNS (fndecl);
current_function_decl = fndecl; current_function_decl = fndecl;
/* This call is only used to initialize global variables. */ /* This call is only used to initialize global variables. */
......
...@@ -32,6 +32,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -32,6 +32,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "recog.h" #include "recog.h"
#include "reload.h" #include "reload.h"
#include "real.h" #include "real.h"
#include "bytecode.h"
#ifndef REGISTER_MOVE_COST #ifndef REGISTER_MOVE_COST
#define REGISTER_MOVE_COST(x, y) 2 #define REGISTER_MOVE_COST(x, y) 2
...@@ -413,6 +414,13 @@ fix_register (name, fixed, call_used) ...@@ -413,6 +414,13 @@ fix_register (name, fixed, call_used)
{ {
int i; 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 /* Decode the name and update the primary form of
the register info. */ the register info. */
......
...@@ -139,6 +139,22 @@ typedef struct rtx_def ...@@ -139,6 +139,22 @@ typedef struct rtx_def
The number of operands and their types are controlled The number of operands and their types are controlled
by the `code' field, according to rtl.def. */ by the `code' field, according to rtl.def. */
rtunion fld[1]; rtunion fld[1];
/* The rest is used instead of the above if bytecode is being output */
/* For static or external objects. */
char *label;
/* From the named label, or the local variable pointer or the
argument pointer, depending on context. */
int offset;
/* For goto labels inside bytecode functions. */
struct bc_label *bc_label;
/* A unique identifier */
int uid;
} *rtx; } *rtx;
/* Add prototype support. */ /* Add prototype support. */
...@@ -640,6 +656,7 @@ extern rtx gen_rtx PROTO((enum rtx_code, enum machine_mode, ...)); ...@@ -640,6 +656,7 @@ extern rtx gen_rtx PROTO((enum rtx_code, enum machine_mode, ...));
extern rtvec gen_rtvec PROTO((int, ...)); extern rtvec gen_rtvec PROTO((int, ...));
#else #else
extern rtx bc_gen_rtx ();
extern rtx gen_rtx (); extern rtx gen_rtx ();
extern rtvec gen_rtvec (); extern rtvec gen_rtvec ();
#endif #endif
......
...@@ -57,6 +57,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -57,6 +57,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef XCOFF_DEBUGGING_INFO #ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h" #include "xcoffout.h"
#endif #endif
#include "bytecode.h"
#include "bc-emit.h"
#ifdef VMS #ifdef VMS
/* The extra parameters substantially improve the I/O performance. */ /* The extra parameters substantially improve the I/O performance. */
...@@ -211,6 +214,9 @@ int errorcount = 0; ...@@ -211,6 +214,9 @@ int errorcount = 0;
int warningcount = 0; int warningcount = 0;
int sorrycount = 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. */ /* Pointer to function to compute the name to use to print a declaration. */
char *(*decl_printable_name) (); char *(*decl_printable_name) ();
...@@ -515,6 +521,7 @@ struct { char *string; int *variable; int on_value;} f_options[] = ...@@ -515,6 +521,7 @@ struct { char *string; int *variable; int on_value;} f_options[] =
{"inhibit-size-directive", &flag_inhibit_size_directive, 1}, {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
{"verbose-asm", &flag_verbose_asm, 1}, {"verbose-asm", &flag_verbose_asm, 1},
{"gnu-linker", &flag_gnu_linker, 1} {"gnu-linker", &flag_gnu_linker, 1}
{"bytecode", &output_bytecode, 1}
}; };
/* Table of language-specific options. */ /* Table of language-specific options. */
...@@ -885,11 +892,14 @@ void ...@@ -885,11 +892,14 @@ void
fatal_insn_not_found (insn) fatal_insn_not_found (insn)
rtx insn; rtx insn;
{ {
if (INSN_CODE (insn) < 0) if (!output_bytecode)
error ("internal error--unrecognizable insn:", 0); {
else if (INSN_CODE (insn) < 0)
error ("internal error--insn does not satisfy its constraints:", 0); error ("internal error--unrecognizable insn:", 0);
debug_rtx (insn); else
error ("internal error--insn does not satisfy its constraints:", 0);
debug_rtx (insn);
}
if (asm_out_file) if (asm_out_file)
fflush (asm_out_file); fflush (asm_out_file);
if (aux_info_file) if (aux_info_file)
...@@ -1585,6 +1595,8 @@ compile_file (name) ...@@ -1585,6 +1595,8 @@ compile_file (name)
init_obstacks (); init_obstacks ();
init_tree_codes (); init_tree_codes ();
init_lex (); init_lex ();
/* Some of these really don't need to be called when generating bytecode,
but the options would have to be parsed first to know that. -bson */
init_rtl (); init_rtl ();
init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
|| debug_info_level == DINFO_LEVEL_VERBOSE); || debug_info_level == DINFO_LEVEL_VERBOSE);
...@@ -1813,34 +1825,51 @@ compile_file (name) ...@@ -1813,34 +1825,51 @@ compile_file (name)
input_file_stack->next = 0; input_file_stack->next = 0;
input_file_stack->name = input_filename; input_file_stack->name = input_filename;
ASM_FILE_START (asm_out_file); if (!output_bytecode)
{
ASM_FILE_START (asm_out_file);
}
/* Output something to inform GDB that this compilation was by GCC. */ /* Output something to inform GDB that this compilation was by GCC. Also
serves to tell GDB file consists of bytecodes. */
if (output_bytecode)
fprintf (asm_out_file, "bc_gcc2_compiled.:\n");
else
{
#ifndef ASM_IDENTIFY_GCC #ifndef ASM_IDENTIFY_GCC
fprintf (asm_out_file, "gcc2_compiled.:\n"); fprintf (asm_out_file, "gcc2_compiled.:\n");
#else #else
ASM_IDENTIFY_GCC (asm_out_file); ASM_IDENTIFY_GCC (asm_out_file);
#endif #endif
}
/* Output something to identify which front-end produced this file. */ /* Output something to identify which front-end produced this file. */
#ifdef ASM_IDENTIFY_LANGUAGE #ifdef ASM_IDENTIFY_LANGUAGE
ASM_IDENTIFY_LANGUAGE (asm_out_file); ASM_IDENTIFY_LANGUAGE (asm_out_file);
#endif #endif
/* ??? Note: There used to be a conditional here if (output_bytecode)
to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined. {
This was to guarantee separation between gcc_compiled. and if (profile_flag || profile_block_flag)
the first function, for the sake of dbx on Suns. error ("profiling not supported in bytecode compilation");
However, having the extra zero here confused the Emacs }
code for unexec, and might confuse other programs too. else
Therefore, I took out that change. {
In future versions we should find another way to solve /* ??? Note: There used to be a conditional here
that dbx problem. -- rms, 23 May 93. */ to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
This was to guarantee separation between gcc_compiled. and
/* Don't let the first function fall at the same address the first function, for the sake of dbx on Suns.
as gcc_compiled., if profiling. */ However, having the extra zero here confused the Emacs
if (profile_flag || profile_block_flag) code for unexec, and might confuse other programs too.
assemble_zeros (UNITS_PER_WORD); Therefore, I took out that change.
In future versions we should find another way to solve
that dbx problem. -- rms, 23 May 93. */
/* Don't let the first function fall at the same address
as gcc_compiled., if profiling. */
if (profile_flag || profile_block_flag)
assemble_zeros (UNITS_PER_WORD);
}
/* If dbx symbol table desired, initialize writing it /* If dbx symbol table desired, initialize writing it
and output the predefined types. */ and output the predefined types. */
...@@ -1861,7 +1890,8 @@ compile_file (name) ...@@ -1861,7 +1890,8 @@ compile_file (name)
/* Initialize yet another pass. */ /* Initialize yet another pass. */
init_final (main_input_filename); if (!output_bytecode)
init_final (main_input_filename);
start_time = get_run_time (); start_time = get_run_time ();
...@@ -2031,11 +2061,14 @@ compile_file (name) ...@@ -2031,11 +2061,14 @@ compile_file (name)
/* Output some stuff at end of file if nec. */ /* Output some stuff at end of file if nec. */
end_final (main_input_filename); if (!output_bytecode)
{
end_final (main_input_filename);
#ifdef ASM_FILE_END #ifdef ASM_FILE_END
ASM_FILE_END (asm_out_file); ASM_FILE_END (asm_out_file);
#endif #endif
}
after_finish_compilation: after_finish_compilation:
...@@ -2113,24 +2146,28 @@ compile_file (name) ...@@ -2113,24 +2146,28 @@ compile_file (name)
{ {
fprintf (stderr,"\n"); fprintf (stderr,"\n");
print_time ("parse", parse_time); print_time ("parse", parse_time);
print_time ("integration", integration_time);
print_time ("jump", jump_time); if (!output_bytecode)
print_time ("cse", cse_time); {
print_time ("loop", loop_time); print_time ("integration", integration_time);
print_time ("cse2", cse2_time); print_time ("jump", jump_time);
print_time ("flow", flow_time); print_time ("cse", cse_time);
print_time ("combine", combine_time); print_time ("loop", loop_time);
print_time ("sched", sched_time); print_time ("cse2", cse2_time);
print_time ("local-alloc", local_alloc_time); print_time ("flow", flow_time);
print_time ("global-alloc", global_alloc_time); print_time ("combine", combine_time);
print_time ("sched2", sched2_time); print_time ("sched", sched_time);
print_time ("dbranch", dbr_sched_time); print_time ("local-alloc", local_alloc_time);
print_time ("shorten-branch", shorten_branch_time); print_time ("global-alloc", global_alloc_time);
print_time ("stack-reg", stack_reg_time); print_time ("sched2", sched2_time);
print_time ("final", final_time); print_time ("dbranch", dbr_sched_time);
print_time ("varconst", varconst_time); print_time ("shorten-branch", shorten_branch_time);
print_time ("symout", symout_time); print_time ("stack-reg", stack_reg_time);
print_time ("dump", dump_time); print_time ("final", final_time);
print_time ("varconst", varconst_time);
print_time ("symout", symout_time);
print_time ("dump", dump_time);
}
} }
} }
...@@ -2236,6 +2273,9 @@ rest_of_compilation (decl) ...@@ -2236,6 +2273,9 @@ rest_of_compilation (decl)
tree saved_arguments = 0; tree saved_arguments = 0;
int failure = 0; int failure = 0;
if (output_bytecode)
return;
/* If we are reconsidering an inline function /* If we are reconsidering an inline function
at the end of compilation, skip the stuff for making it inline. */ at the end of compilation, skip the stuff for making it inline. */
...@@ -3166,7 +3206,12 @@ main (argc, argv, envp) ...@@ -3166,7 +3206,12 @@ main (argc, argv, envp)
error ("Invalid option `%s'", argv[i]); error ("Invalid option `%s'", argv[i]);
} }
else if (!strcmp (str, "p")) else if (!strcmp (str, "p"))
profile_flag = 1; {
if (!output_bytecode)
profile_flag = 1;
else
error ("profiling not supported in bytecode compilation");
}
else if (!strcmp (str, "a")) else if (!strcmp (str, "a"))
{ {
#if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER) #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
...@@ -3325,6 +3370,18 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE! ...@@ -3325,6 +3370,18 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
filename = argv[i]; filename = argv[i];
} }
/* Initialize for bytecode output. A good idea to do this as soon as
possible after the "-f" options have been parsed. */
if (output_bytecode)
{
#ifndef TARGET_SUPPORTS_BYTECODE
/* Just die with a fatal error if not supported */
fatal ("-fbytecode can not be used for this target");
#else
bc_initialize ();
#endif
}
if (optimize == 0) if (optimize == 0)
{ {
/* Inlining does not work if not optimizing, /* Inlining does not work if not optimizing,
...@@ -3398,10 +3455,14 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE! ...@@ -3398,10 +3455,14 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
} }
/* Now that register usage is specified, convert it to HARD_REG_SETs. */ /* Now that register usage is specified, convert it to HARD_REG_SETs. */
init_reg_sets_1 (); if (!output_bytecode)
init_reg_sets_1 ();
compile_file (filename); compile_file (filename);
if (output_bytecode)
bc_write_file (stdout);
#ifndef OS2 #ifndef OS2
#ifndef VMS #ifndef VMS
if (flag_print_mem) if (flag_print_mem)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment