*** gcc/Makefile.orig	Fri Sep 22 16:47:25 1989
--- gcc/Makefile	Wed Feb 14 16:22:16 1990
***************
*** 42,50 ****
  # Directory where sources are, from where we are.
  srcdir = .
  # Directory in which to put the executable for the command `gcc'
! bindir = $(prefix)/usr/local/bin
  # Directory in which to put the subprograms used by the compiler.
! libdir = $(prefix)/usr/local/lib
  # Directory in which to put man pages.
  mandir = $(prefix)/usr/local/man/man1
  # Number to put in man-page filename.
--- 42,50 ----
  # Directory where sources are, from where we are.
  srcdir = .
  # Directory in which to put the executable for the command `gcc'
! bindir = /var/home/larus/AE/gcc/bin
  # Directory in which to put the subprograms used by the compiler.
! libdir = /var/home/larus/AE/gcc/lib
  # Directory in which to put man pages.
  mandir = $(prefix)/usr/local/man/man1
  # Number to put in man-page filename.
***************
*** 137,142 ****
--- 137,145 ----
   regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \
   insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o
  
+ # Files for AE.
+ AE_OBJS = ae.o ae-loop.o ae-output.o ae-rd.o
+ 
  # Files to be copied away after each stage in building.
  STAGE_GCC=gcc
  STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
***************
*** 201,206 ****
--- 204,216 ----
  cc1: $(C_OBJS) $(OBJS) $(LIBDEPS)
  	$(CC) $(CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(LIBS)
  
+ ae: gcc.o version.o cc1-ae
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o gccnew gcc.o version.o $(LIBS)
+ 	mv gccnew gcc
+ 
+ cc1-ae: $(C_OBJS) $(OBJS) $(AE_OBJS) $(LIBDEPS)
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(AE_OBJS) $(LIBS)
+ 
  cc1plus: $(CPLUS_OBJS) $(OBJS) $(LIBDEPS)
  	$(CC) $(CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(OBJS) $(LIBS)
  
***************
*** 362,367 ****
--- 372,388 ----
  recog.o : recog.c $(CONFIG_H) $(RTL_H)  \
     regs.h recog.h hard-reg-set.h insn-config.h real.h
  
+ ae.o : ae.c ae.h ae-machine.h schema.h $(CONFIG.H) $(RTL.H) basic-block.h \
+        flags.h insn-config.h
+ 
+ ae-loop.o : ae-loop.c ae.h $(CONFIG.H) $(RTL.H) basic-block.h
+ 
+ ae-output.o : ae-output.c ae.h ae-machine.h $(CONFIG.H) $(RTL.H) \
+ 	      basic-block.h flags.h regs.h
+ 
+ ae-rd.o : ae-rd.c ae.h $(CONFIG.H) $(RTL.H) basic-block.h
+ 
+ 
  # Normally this target is not used; but it is used if you
  # define ALLOCA=alloca.o.  In that case, you must get a suitable alloca.c
  # from the GNU Emacs distribution.
***************
*** 516,521 ****
--- 537,555 ----
  $(srcdir)/gcc.info: $(srcdir)/gcc.texinfo
  	makeinfo `echo $(srcdir)/gcc.texinfo | sed 's,^\./,,'`
  
+ # Make the AE runtime code.
+ aecrt0.o : ae-buffer.o aecrt.o
+ 	ld -o aecrt0.o -r aecrt.o ae-buffer.o
+ 
+ ae-buffer.o: ae-buffer.c ae.h ae-machine.h
+ 	gcc -O -c ae-buffer.c
+ 
+ aecrt.o: aecrt.s
+ 	/lib/cpp -P aecrt.s | tr "" " " > aecrt.x.s
+ 	as aecrt.x.s -o aecrt.o
+ 	rm -f aecrt.x.s
+ 
+ 
  # gnulib is not deleted because deleting it would be inconvenient
  # for most uses of this target.
  clean:
***************
*** 557,563 ****
--- 591,599 ----
  	for file in $(USER_H); do $(INSTALL) $(srcdir)/$${file} $(libdir)/gcc-include; done
  	$(INSTALL) float.h $(libdir)/gcc-include/float.h
  	$(INSTALL) $(srcdir)/gvarargs.h $(libdir)/gcc-include/varargs.h
+ 	$(INSTALL) $(srcdir)/aecrt0.o $(libdir)/aecrt0.o
  	$(INSTALL) $(srcdir)/gcc.1 $(mandir)/gcc.$(manext)
+ 
  
  # do make -f ../gcc/Makefile maketest DIR=../gcc
  # in the intended test directory to make it a suitable test directory.
*** gcc/final.c.orig	Tue Aug 22 22:16:56 1989
--- gcc/final.c	Mon Feb  5 14:22:52 1990
***************
*** 54,59 ****
--- 54,60 ----
  #include "flags.h"
  #include "real.h"
  #include "output.h"
+ #include "ae.h"
  
  /* Get N_SLINE and N_SOL from stab.h if we can expect the file to exist.  */
  #ifdef DBX_DEBUGGING_INFO
***************
*** 206,211 ****
--- 207,216 ----
     Zero otherwise.  */
  
  rtx final_sequence;
+ 
+ #ifdef AE
+ int ae_enable;
+ #endif
  
  /* Initialize data in final at the beginning of a compilation.  */
  
***************
*** 483,488 ****
--- 488,498 ----
      sdbout_end_function (last_linenum);
  #endif
  
+ #ifdef AE
+   if (ae_enable)
+     ae_end_function ();
+ #endif
+ 
  #ifdef FUNCTION_EPILOGUE
    /* Finally, output the function epilogue:
       code to restore the stack frame and return to the caller.  */
***************
*** 549,554 ****
--- 559,565 ----
       int nopeepholes;
  {
    register int i;
+ 
    switch (GET_CODE (insn))
      {
      case NOTE:
***************
*** 640,645 ****
--- 651,660 ----
        CC_STATUS_INIT;
        if (prescan > 0)
  	break;
+ #ifdef AE
+       if (ae_enable)
+ 	watch_insn_output (insn);
+ #endif
        new_block = 1;
        if (app_on)
  	{
***************
*** 664,670 ****
  	    }
  	}
  #endif
- 
        ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
        break;
  
--- 679,684 ----
***************
*** 762,767 ****
--- 776,785 ----
  	    if (prescan > 0)
  	      break;
  
+ #ifdef AE
+ 	    if (ae_enable)
+ 	      watch_insn_output (insn);
+ #endif
  	    vlen = XVECLEN (body, 0);
  	    for (idx = 0; idx < vlen; idx++)
  	      ASM_OUTPUT_ADDR_VEC_ELT (file,
***************
*** 780,785 ****
--- 798,807 ----
  	    if (prescan > 0)
  	      break;
  
+ #ifdef AE
+ 	    if (ae_enable)
+ 	      watch_insn_output (insn);
+ #endif
  	    vlen = XVECLEN (body, 1);
  	    for (idx = 0; idx < vlen; idx++)
  	      ASM_OUTPUT_ADDR_DIFF_ELT (file,
***************
*** 841,846 ****
--- 863,872 ----
  		  {
  		    /* We don't really delete the insn; just ignore it.  */
  		    last_ignored_compare = insn;
+ #ifdef AE
+ 		    if (ae_enable)
+ 		      watch_insn_output (insn);
+ #endif
  		    break;
  		  }
  	      }
***************
*** 973,978 ****
--- 999,1005 ----
  	      recog_operand[i] = alter_subreg (recog_operand[i]);
  	  }
  
+ 
  #ifdef REGISTER_CONSTRAINTS
  	if (! constrain_operands (insn_code_number))
  	  abort ();
***************
*** 998,1003 ****
--- 1025,1035 ----
  	/* If the proper template needs to be chosen by some C code,
  	   run that code and get the real template.  */
  
+ #ifdef AE
+ 	if (ae_enable)
+ 	  watch_insn_output (insn);
+ #endif
+ 
  	template = insn_template[insn_code_number];
  	if (template == 0)
  	  {
***************
*** 1019,1025 ****
  	  break;
  
  	/* Output assembler code from the template.  */
- 
  	output_asm_insn (template, recog_operand);
  
  	/* Mark this insn as having been output.  */
--- 1051,1056 ----
***************
*** 1476,1481 ****
--- 1507,1517 ----
      }
  
    putc ('\n', asm_out_file);
+ 
+ #ifdef AE
+   if (ae_enable)
+     watch_asm_insn_output (template, operands);
+ #endif
  }
  
  /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol.  */
*** gcc/flow.c.orig	Sun Jul 30 18:39:37 1989
--- gcc/flow.c	Fri Dec  8 09:22:57 1989
***************
*** 111,122 ****
     This is set up by find_basic_blocks and used there and in life_analysis,
     and then freed.  */
  
! static short *uid_block_number;
  
  /* INSN_VOLATILE (insn) is 1 if the insn refers to anything volatile.  */
  
  #define INSN_VOLATILE(INSN) uid_volatile[INSN_UID (INSN)]
! static char *uid_volatile;
  
  /* Number of basic blocks in the current function.  */
  
--- 111,122 ----
     This is set up by find_basic_blocks and used there and in life_analysis,
     and then freed.  */
  
! short *uid_block_number;
  
  /* INSN_VOLATILE (insn) is 1 if the insn refers to anything volatile.  */
  
  #define INSN_VOLATILE(INSN) uid_volatile[INSN_UID (INSN)]
! char *uid_volatile;
  
  /* Number of basic blocks in the current function.  */
  
***************
*** 212,223 ****
  /* Element N is nonzero if control can drop into basic block N
     from the preceding basic block.  Freed after life_analysis.  */
  
! static char *basic_block_drops_in;
  
  /* Element N is depth within loops of basic block number N.
     Freed after life_analysis.  */
  
! static short *basic_block_loop_depth;
  
  /* Element N nonzero if basic block N can actually be reached.
     Vector exists only during find_basic_blocks.  */
--- 212,223 ----
  /* Element N is nonzero if control can drop into basic block N
     from the preceding basic block.  Freed after life_analysis.  */
  
! char *basic_block_drops_in;
  
  /* Element N is depth within loops of basic block number N.
     Freed after life_analysis.  */
  
! short *basic_block_loop_depth;
  
  /* Element N nonzero if basic block N can actually be reached.
     Vector exists only during find_basic_blocks.  */
***************
*** 228,233 ****
--- 228,234 ----
     plus one.  This is the weight attached to references to registers.  */
  
  static int loop_depth;
+ 
  
  /* Define AUTO_INC_DEC if machine has any kind of incrementing
     or decrementing addressing.  */
***************
*** 249,259 ****
  #endif
  
  /* Forward declarations */
! static void find_basic_blocks ();
  static void life_analysis ();
  static void mark_label_ref ();
  void allocate_for_life_analysis (); /* Used also in stupid_life_analysis */
! static void init_regset_vector ();
  static void propagate_block ();
  static void mark_set_regs ();
  static void mark_used_regs ();
--- 250,260 ----
  #endif
  
  /* Forward declarations */
! void find_basic_blocks ();
  static void life_analysis ();
  static void mark_label_ref ();
  void allocate_for_life_analysis (); /* Used also in stupid_life_analysis */
! void init_regset_vector ();
  static void propagate_block ();
  static void mark_set_regs ();
  static void mark_used_regs ();
***************
*** 326,332 ****
     set up the chains of references for each CODE_LABEL, and
     delete any entire basic blocks that cannot be reached.  */
  
! static void
  find_basic_blocks (f)
       rtx f;
  {
--- 327,333 ----
     set up the chains of references for each CODE_LABEL, and
     delete any entire basic blocks that cannot be reached.  */
  
! void
  find_basic_blocks (f)
       rtx f;
  {
***************
*** 887,893 ****
     SPACE is of type regset, but it is really as long as NELTS regsets.
     BYTES_PER_ELT is the number of bytes in one regset.  */
  
! static void
  init_regset_vector (vector, space, nelts, bytes_per_elt)
       regset *vector;
       regset space;
--- 888,894 ----
     SPACE is of type regset, but it is really as long as NELTS regsets.
     BYTES_PER_ELT is the number of bytes in one regset.  */
  
! void
  init_regset_vector (vector, space, nelts, bytes_per_elt)
       regset *vector;
       regset space;
*** gcc/toplev.c.orig	Thu Sep  7 22:21:14 1989
--- gcc/toplev.c	Tue Feb  6 15:40:16 1990
***************
*** 51,56 ****
--- 51,59 ----
  #include "rtl.h"
  #include "flags.h"
  
+ #include "ae.h"
+ #include "ae-machine.h"
+ 
  extern int yydebug;
  
  extern FILE *finput;
***************
*** 316,321 ****
--- 319,331 ----
      if `-fSTRING' is seen as an option.
     (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
  
+ #ifdef AE
+ /* Non-zero if compilation should insert AE profiling code and create schema
+    file. */
+ 
+ int ae_enable = 0;
+ #endif
+ 
  struct { char *string; int *variable; int on_value;} f_options[] =
  {
    {"float-store", &flag_float_store, 1},
***************
*** 352,357 ****
--- 362,370 ----
  FILE *global_reg_dump_file;
  FILE *jump2_opt_dump_file;
  FILE *dbr_sched_dump_file;
+ #ifdef AE
+ FILE *schema_out_file;
+ #endif
  
  /* Time accumulators, to count the total time spent in various passes.  */
  
***************
*** 1050,1055 ****
--- 1063,1088 ----
  	pfatal_with_name (asm_file_name);
      }
  
+ #ifdef AE
+   if (ae_enable)
+     {
+       register char *schema_name =
+ 	(char *) xmalloc (dump_base_name_length + 6);
+       int len = strlen (dump_base_name);
+       strcpy (schema_name, dump_base_name);
+       if (len > 2 && ! strcmp (".c", schema_name + len - 2))
+ 	schema_name[len - 2] = 0;
+       else if (len > 2 && ! strcmp (".i", schema_name + len - 2))
+ 	schema_name[len - 2] = 0;
+       else if (len > 3 && ! strcmp (".co", schema_name + len - 3))
+ 	schema_name[len - 3] = 0;
+       strcat (schema_name, ".sma");
+       schema_out_file = fopen (schema_name, "w");
+       if (asm_out_file == 0)
+ 	pfatal_with_name (schema_name);
+     }
+ #endif
+ 
    input_filename = name;
  
    /* the beginning of the file is a new line; check for # */
***************
*** 1668,1673 ****
--- 1701,1711 ----
  
    /* Now turn the rtl into assembler code.  */
  
+ #ifdef AE
+ 	     if (ae_enable)
+ 	       ae_function (insns, asm_out_file, write_symbols, optimize,
+ 			    decl);
+ #endif
    TIMEVAR (final_time,
  	   {
  	     assemble_function (decl);
***************
*** 1879,1884 ****
--- 1917,1926 ----
  	  optimize = 1, obey_regdecls = 0;
  	else if (!strcmp (str, "O"))
  	  optimize = 1, obey_regdecls = 0;
+ #ifdef AE
+ 	else if (!strcmp (str, "AE"))
+ 	  ae_enable = 1;
+ #endif
  	else if (!strcmp (str, "pedantic"))
  	  pedantic = 1;
  	else if (lang_decode_option (argv[i]))
***************
*** 1979,1984 ****
--- 2021,2033 ----
        }
      else
        filename = argv[i];
+ 
+ #ifdef AE
+   fix_register (AE_BUFFER_REG, 1, 1); /* Reserve register for ae_bp */
+ #ifdef AE_BUFFER_BOUND_REG
+   fix_register (AE_BUFFER_BOUND_REG, 1, 1); /* Reserve register */
+ #endif
+ #endif
  
  #ifdef OVERRIDE_OPTIONS
    /* Some machines may reject certain combinations of options.  */
*** gcc/config.gcc.orig	Sat Sep 23 23:13:11 1989
--- gcc/config.gcc	Tue Feb  6 11:57:35 1990
***************
*** 148,153 ****
--- 148,157 ----
  		cpu_type=sparc
  		target_machine=tm-sparc.h
  		;;
+ 	sun4-os4-ae | sun-4-os4-ae)
+ 		cpu_type=sparc
+ 		target_machine=tm-sparc-ae.h
+ 		;;
  	sun3-os4 | sun-3-os4)
  		cpu_type=m68k
  		target_machine=tm-sun3.h
***************
*** 247,252 ****
--- 251,260 ----
  	dec-3100 | decstation)		# Decstation or pmax.
  		cpu_type=mips
  		target_machine=tm-decstatn.h
+ 	        ;;
+ 	dec-3100-ae | decstation-ae)		# Decstation or pmax.
+ 		cpu_type=mips
+ 		target_machine=tm-decstatn-ae.h
  	        ;;
  	apollo68)
  		cpu_type=m68k
