home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / ae / patch-gcc < prev    next >
Encoding:
Text File  |  1990-02-28  |  13.9 KB  |  532 lines

  1. *** gcc/Makefile.orig    Fri Sep 22 16:47:25 1989
  2. --- gcc/Makefile    Wed Feb 14 16:22:16 1990
  3. ***************
  4. *** 42,50 ****
  5.   # Directory where sources are, from where we are.
  6.   srcdir = .
  7.   # Directory in which to put the executable for the command `gcc'
  8. ! bindir = $(prefix)/usr/local/bin
  9.   # Directory in which to put the subprograms used by the compiler.
  10. ! libdir = $(prefix)/usr/local/lib
  11.   # Directory in which to put man pages.
  12.   mandir = $(prefix)/usr/local/man/man1
  13.   # Number to put in man-page filename.
  14. --- 42,50 ----
  15.   # Directory where sources are, from where we are.
  16.   srcdir = .
  17.   # Directory in which to put the executable for the command `gcc'
  18. ! bindir = /var/home/larus/AE/gcc/bin
  19.   # Directory in which to put the subprograms used by the compiler.
  20. ! libdir = /var/home/larus/AE/gcc/lib
  21.   # Directory in which to put man pages.
  22.   mandir = $(prefix)/usr/local/man/man1
  23.   # Number to put in man-page filename.
  24. ***************
  25. *** 137,142 ****
  26. --- 137,145 ----
  27.    regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \
  28.    insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o
  29.   
  30. + # Files for AE.
  31. + AE_OBJS = ae.o ae-loop.o ae-output.o ae-rd.o
  32.   # Files to be copied away after each stage in building.
  33.   STAGE_GCC=gcc
  34.   STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
  35. ***************
  36. *** 201,206 ****
  37. --- 204,216 ----
  38.   cc1: $(C_OBJS) $(OBJS) $(LIBDEPS)
  39.       $(CC) $(CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(LIBS)
  40.   
  41. + ae: gcc.o version.o cc1-ae
  42. +     $(CC) $(CFLAGS) $(LDFLAGS) -o gccnew gcc.o version.o $(LIBS)
  43. +     mv gccnew gcc
  44. + cc1-ae: $(C_OBJS) $(OBJS) $(AE_OBJS) $(LIBDEPS)
  45. +     $(CC) $(CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(AE_OBJS) $(LIBS)
  46.   cc1plus: $(CPLUS_OBJS) $(OBJS) $(LIBDEPS)
  47.       $(CC) $(CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(OBJS) $(LIBS)
  48.   
  49. ***************
  50. *** 362,367 ****
  51. --- 372,388 ----
  52.   recog.o : recog.c $(CONFIG_H) $(RTL_H)  \
  53.      regs.h recog.h hard-reg-set.h insn-config.h real.h
  54.   
  55. + ae.o : ae.c ae.h ae-machine.h schema.h $(CONFIG.H) $(RTL.H) basic-block.h \
  56. +        flags.h insn-config.h
  57. + ae-loop.o : ae-loop.c ae.h $(CONFIG.H) $(RTL.H) basic-block.h
  58. + ae-output.o : ae-output.c ae.h ae-machine.h $(CONFIG.H) $(RTL.H) \
  59. +           basic-block.h flags.h regs.h
  60. + ae-rd.o : ae-rd.c ae.h $(CONFIG.H) $(RTL.H) basic-block.h
  61.   # Normally this target is not used; but it is used if you
  62.   # define ALLOCA=alloca.o.  In that case, you must get a suitable alloca.c
  63.   # from the GNU Emacs distribution.
  64. ***************
  65. *** 516,521 ****
  66. --- 537,555 ----
  67.   $(srcdir)/gcc.info: $(srcdir)/gcc.texinfo
  68.       makeinfo `echo $(srcdir)/gcc.texinfo | sed 's,^\./,,'`
  69.   
  70. + # Make the AE runtime code.
  71. + aecrt0.o : ae-buffer.o aecrt.o
  72. +     ld -o aecrt0.o -r aecrt.o ae-buffer.o
  73. + ae-buffer.o: ae-buffer.c ae.h ae-machine.h
  74. +     gcc -O -c ae-buffer.c
  75. + aecrt.o: aecrt.s
  76. +     /lib/cpp -P aecrt.s | tr " " " " > aecrt.x.s
  77. +     as aecrt.x.s -o aecrt.o
  78. +     rm -f aecrt.x.s
  79.   # gnulib is not deleted because deleting it would be inconvenient
  80.   # for most uses of this target.
  81.   clean:
  82. ***************
  83. *** 557,563 ****
  84. --- 591,599 ----
  85.       for file in $(USER_H); do $(INSTALL) $(srcdir)/$${file} $(libdir)/gcc-include; done
  86.       $(INSTALL) float.h $(libdir)/gcc-include/float.h
  87.       $(INSTALL) $(srcdir)/gvarargs.h $(libdir)/gcc-include/varargs.h
  88. +     $(INSTALL) $(srcdir)/aecrt0.o $(libdir)/aecrt0.o
  89.       $(INSTALL) $(srcdir)/gcc.1 $(mandir)/gcc.$(manext)
  90.   
  91.   # do make -f ../gcc/Makefile maketest DIR=../gcc
  92.   # in the intended test directory to make it a suitable test directory.
  93. *** gcc/final.c.orig    Tue Aug 22 22:16:56 1989
  94. --- gcc/final.c    Mon Feb  5 14:22:52 1990
  95. ***************
  96. *** 54,59 ****
  97. --- 54,60 ----
  98.   #include "flags.h"
  99.   #include "real.h"
  100.   #include "output.h"
  101. + #include "ae.h"
  102.   
  103.   /* Get N_SLINE and N_SOL from stab.h if we can expect the file to exist.  */
  104.   #ifdef DBX_DEBUGGING_INFO
  105. ***************
  106. *** 206,211 ****
  107. --- 207,216 ----
  108.      Zero otherwise.  */
  109.   
  110.   rtx final_sequence;
  111. + #ifdef AE
  112. + int ae_enable;
  113. + #endif
  114.   
  115.   /* Initialize data in final at the beginning of a compilation.  */
  116.   
  117. ***************
  118. *** 483,488 ****
  119. --- 488,498 ----
  120.       sdbout_end_function (last_linenum);
  121.   #endif
  122.   
  123. + #ifdef AE
  124. +   if (ae_enable)
  125. +     ae_end_function ();
  126. + #endif
  127.   #ifdef FUNCTION_EPILOGUE
  128.     /* Finally, output the function epilogue:
  129.        code to restore the stack frame and return to the caller.  */
  130. ***************
  131. *** 549,554 ****
  132. --- 559,565 ----
  133.        int nopeepholes;
  134.   {
  135.     register int i;
  136.     switch (GET_CODE (insn))
  137.       {
  138.       case NOTE:
  139. ***************
  140. *** 640,645 ****
  141. --- 651,660 ----
  142.         CC_STATUS_INIT;
  143.         if (prescan > 0)
  144.       break;
  145. + #ifdef AE
  146. +       if (ae_enable)
  147. +     watch_insn_output (insn);
  148. + #endif
  149.         new_block = 1;
  150.         if (app_on)
  151.       {
  152. ***************
  153. *** 664,670 ****
  154.           }
  155.       }
  156.   #endif
  157.         ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
  158.         break;
  159.   
  160. --- 679,684 ----
  161. ***************
  162. *** 762,767 ****
  163. --- 776,785 ----
  164.           if (prescan > 0)
  165.             break;
  166.   
  167. + #ifdef AE
  168. +         if (ae_enable)
  169. +           watch_insn_output (insn);
  170. + #endif
  171.           vlen = XVECLEN (body, 0);
  172.           for (idx = 0; idx < vlen; idx++)
  173.             ASM_OUTPUT_ADDR_VEC_ELT (file,
  174. ***************
  175. *** 780,785 ****
  176. --- 798,807 ----
  177.           if (prescan > 0)
  178.             break;
  179.   
  180. + #ifdef AE
  181. +         if (ae_enable)
  182. +           watch_insn_output (insn);
  183. + #endif
  184.           vlen = XVECLEN (body, 1);
  185.           for (idx = 0; idx < vlen; idx++)
  186.             ASM_OUTPUT_ADDR_DIFF_ELT (file,
  187. ***************
  188. *** 841,846 ****
  189. --- 863,872 ----
  190.             {
  191.               /* We don't really delete the insn; just ignore it.  */
  192.               last_ignored_compare = insn;
  193. + #ifdef AE
  194. +             if (ae_enable)
  195. +               watch_insn_output (insn);
  196. + #endif
  197.               break;
  198.             }
  199.             }
  200. ***************
  201. *** 973,978 ****
  202. --- 999,1005 ----
  203.             recog_operand[i] = alter_subreg (recog_operand[i]);
  204.         }
  205.   
  206.   #ifdef REGISTER_CONSTRAINTS
  207.       if (! constrain_operands (insn_code_number))
  208.         abort ();
  209. ***************
  210. *** 998,1003 ****
  211. --- 1025,1035 ----
  212.       /* If the proper template needs to be chosen by some C code,
  213.          run that code and get the real template.  */
  214.   
  215. + #ifdef AE
  216. +     if (ae_enable)
  217. +       watch_insn_output (insn);
  218. + #endif
  219.       template = insn_template[insn_code_number];
  220.       if (template == 0)
  221.         {
  222. ***************
  223. *** 1019,1025 ****
  224.         break;
  225.   
  226.       /* Output assembler code from the template.  */
  227.       output_asm_insn (template, recog_operand);
  228.   
  229.       /* Mark this insn as having been output.  */
  230. --- 1051,1056 ----
  231. ***************
  232. *** 1476,1481 ****
  233. --- 1507,1517 ----
  234.       }
  235.   
  236.     putc ('\n', asm_out_file);
  237. + #ifdef AE
  238. +   if (ae_enable)
  239. +     watch_asm_insn_output (template, operands);
  240. + #endif
  241.   }
  242.   
  243.   /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol.  */
  244. *** gcc/flow.c.orig    Sun Jul 30 18:39:37 1989
  245. --- gcc/flow.c    Fri Dec  8 09:22:57 1989
  246. ***************
  247. *** 111,122 ****
  248.      This is set up by find_basic_blocks and used there and in life_analysis,
  249.      and then freed.  */
  250.   
  251. ! static short *uid_block_number;
  252.   
  253.   /* INSN_VOLATILE (insn) is 1 if the insn refers to anything volatile.  */
  254.   
  255.   #define INSN_VOLATILE(INSN) uid_volatile[INSN_UID (INSN)]
  256. ! static char *uid_volatile;
  257.   
  258.   /* Number of basic blocks in the current function.  */
  259.   
  260. --- 111,122 ----
  261.      This is set up by find_basic_blocks and used there and in life_analysis,
  262.      and then freed.  */
  263.   
  264. ! short *uid_block_number;
  265.   
  266.   /* INSN_VOLATILE (insn) is 1 if the insn refers to anything volatile.  */
  267.   
  268.   #define INSN_VOLATILE(INSN) uid_volatile[INSN_UID (INSN)]
  269. ! char *uid_volatile;
  270.   
  271.   /* Number of basic blocks in the current function.  */
  272.   
  273. ***************
  274. *** 212,223 ****
  275.   /* Element N is nonzero if control can drop into basic block N
  276.      from the preceding basic block.  Freed after life_analysis.  */
  277.   
  278. ! static char *basic_block_drops_in;
  279.   
  280.   /* Element N is depth within loops of basic block number N.
  281.      Freed after life_analysis.  */
  282.   
  283. ! static short *basic_block_loop_depth;
  284.   
  285.   /* Element N nonzero if basic block N can actually be reached.
  286.      Vector exists only during find_basic_blocks.  */
  287. --- 212,223 ----
  288.   /* Element N is nonzero if control can drop into basic block N
  289.      from the preceding basic block.  Freed after life_analysis.  */
  290.   
  291. ! char *basic_block_drops_in;
  292.   
  293.   /* Element N is depth within loops of basic block number N.
  294.      Freed after life_analysis.  */
  295.   
  296. ! short *basic_block_loop_depth;
  297.   
  298.   /* Element N nonzero if basic block N can actually be reached.
  299.      Vector exists only during find_basic_blocks.  */
  300. ***************
  301. *** 228,233 ****
  302. --- 228,234 ----
  303.      plus one.  This is the weight attached to references to registers.  */
  304.   
  305.   static int loop_depth;
  306.   
  307.   /* Define AUTO_INC_DEC if machine has any kind of incrementing
  308.      or decrementing addressing.  */
  309. ***************
  310. *** 249,259 ****
  311.   #endif
  312.   
  313.   /* Forward declarations */
  314. ! static void find_basic_blocks ();
  315.   static void life_analysis ();
  316.   static void mark_label_ref ();
  317.   void allocate_for_life_analysis (); /* Used also in stupid_life_analysis */
  318. ! static void init_regset_vector ();
  319.   static void propagate_block ();
  320.   static void mark_set_regs ();
  321.   static void mark_used_regs ();
  322. --- 250,260 ----
  323.   #endif
  324.   
  325.   /* Forward declarations */
  326. ! void find_basic_blocks ();
  327.   static void life_analysis ();
  328.   static void mark_label_ref ();
  329.   void allocate_for_life_analysis (); /* Used also in stupid_life_analysis */
  330. ! void init_regset_vector ();
  331.   static void propagate_block ();
  332.   static void mark_set_regs ();
  333.   static void mark_used_regs ();
  334. ***************
  335. *** 326,332 ****
  336.      set up the chains of references for each CODE_LABEL, and
  337.      delete any entire basic blocks that cannot be reached.  */
  338.   
  339. ! static void
  340.   find_basic_blocks (f)
  341.        rtx f;
  342.   {
  343. --- 327,333 ----
  344.      set up the chains of references for each CODE_LABEL, and
  345.      delete any entire basic blocks that cannot be reached.  */
  346.   
  347. ! void
  348.   find_basic_blocks (f)
  349.        rtx f;
  350.   {
  351. ***************
  352. *** 887,893 ****
  353.      SPACE is of type regset, but it is really as long as NELTS regsets.
  354.      BYTES_PER_ELT is the number of bytes in one regset.  */
  355.   
  356. ! static void
  357.   init_regset_vector (vector, space, nelts, bytes_per_elt)
  358.        regset *vector;
  359.        regset space;
  360. --- 888,894 ----
  361.      SPACE is of type regset, but it is really as long as NELTS regsets.
  362.      BYTES_PER_ELT is the number of bytes in one regset.  */
  363.   
  364. ! void
  365.   init_regset_vector (vector, space, nelts, bytes_per_elt)
  366.        regset *vector;
  367.        regset space;
  368. *** gcc/toplev.c.orig    Thu Sep  7 22:21:14 1989
  369. --- gcc/toplev.c    Tue Feb  6 15:40:16 1990
  370. ***************
  371. *** 51,56 ****
  372. --- 51,59 ----
  373.   #include "rtl.h"
  374.   #include "flags.h"
  375.   
  376. + #include "ae.h"
  377. + #include "ae-machine.h"
  378.   extern int yydebug;
  379.   
  380.   extern FILE *finput;
  381. ***************
  382. *** 316,321 ****
  383. --- 319,331 ----
  384.       if `-fSTRING' is seen as an option.
  385.      (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
  386.   
  387. + #ifdef AE
  388. + /* Non-zero if compilation should insert AE profiling code and create schema
  389. +    file. */
  390. + int ae_enable = 0;
  391. + #endif
  392.   struct { char *string; int *variable; int on_value;} f_options[] =
  393.   {
  394.     {"float-store", &flag_float_store, 1},
  395. ***************
  396. *** 352,357 ****
  397. --- 362,370 ----
  398.   FILE *global_reg_dump_file;
  399.   FILE *jump2_opt_dump_file;
  400.   FILE *dbr_sched_dump_file;
  401. + #ifdef AE
  402. + FILE *schema_out_file;
  403. + #endif
  404.   
  405.   /* Time accumulators, to count the total time spent in various passes.  */
  406.   
  407. ***************
  408. *** 1050,1055 ****
  409. --- 1063,1088 ----
  410.       pfatal_with_name (asm_file_name);
  411.       }
  412.   
  413. + #ifdef AE
  414. +   if (ae_enable)
  415. +     {
  416. +       register char *schema_name =
  417. +     (char *) xmalloc (dump_base_name_length + 6);
  418. +       int len = strlen (dump_base_name);
  419. +       strcpy (schema_name, dump_base_name);
  420. +       if (len > 2 && ! strcmp (".c", schema_name + len - 2))
  421. +     schema_name[len - 2] = 0;
  422. +       else if (len > 2 && ! strcmp (".i", schema_name + len - 2))
  423. +     schema_name[len - 2] = 0;
  424. +       else if (len > 3 && ! strcmp (".co", schema_name + len - 3))
  425. +     schema_name[len - 3] = 0;
  426. +       strcat (schema_name, ".sma");
  427. +       schema_out_file = fopen (schema_name, "w");
  428. +       if (asm_out_file == 0)
  429. +     pfatal_with_name (schema_name);
  430. +     }
  431. + #endif
  432.     input_filename = name;
  433.   
  434.     /* the beginning of the file is a new line; check for # */
  435. ***************
  436. *** 1668,1673 ****
  437. --- 1701,1711 ----
  438.   
  439.     /* Now turn the rtl into assembler code.  */
  440.   
  441. + #ifdef AE
  442. +          if (ae_enable)
  443. +            ae_function (insns, asm_out_file, write_symbols, optimize,
  444. +                 decl);
  445. + #endif
  446.     TIMEVAR (final_time,
  447.          {
  448.            assemble_function (decl);
  449. ***************
  450. *** 1879,1884 ****
  451. --- 1917,1926 ----
  452.         optimize = 1, obey_regdecls = 0;
  453.       else if (!strcmp (str, "O"))
  454.         optimize = 1, obey_regdecls = 0;
  455. + #ifdef AE
  456. +     else if (!strcmp (str, "AE"))
  457. +       ae_enable = 1;
  458. + #endif
  459.       else if (!strcmp (str, "pedantic"))
  460.         pedantic = 1;
  461.       else if (lang_decode_option (argv[i]))
  462. ***************
  463. *** 1979,1984 ****
  464. --- 2021,2033 ----
  465.         }
  466.       else
  467.         filename = argv[i];
  468. + #ifdef AE
  469. +   fix_register (AE_BUFFER_REG, 1, 1); /* Reserve register for ae_bp */
  470. + #ifdef AE_BUFFER_BOUND_REG
  471. +   fix_register (AE_BUFFER_BOUND_REG, 1, 1); /* Reserve register */
  472. + #endif
  473. + #endif
  474.   
  475.   #ifdef OVERRIDE_OPTIONS
  476.     /* Some machines may reject certain combinations of options.  */
  477. *** gcc/config.gcc.orig    Sat Sep 23 23:13:11 1989
  478. --- gcc/config.gcc    Tue Feb  6 11:57:35 1990
  479. ***************
  480. *** 148,153 ****
  481. --- 148,157 ----
  482.           cpu_type=sparc
  483.           target_machine=tm-sparc.h
  484.           ;;
  485. +     sun4-os4-ae | sun-4-os4-ae)
  486. +         cpu_type=sparc
  487. +         target_machine=tm-sparc-ae.h
  488. +         ;;
  489.       sun3-os4 | sun-3-os4)
  490.           cpu_type=m68k
  491.           target_machine=tm-sun3.h
  492. ***************
  493. *** 247,252 ****
  494. --- 251,260 ----
  495.       dec-3100 | decstation)        # Decstation or pmax.
  496.           cpu_type=mips
  497.           target_machine=tm-decstatn.h
  498. +             ;;
  499. +     dec-3100-ae | decstation-ae)        # Decstation or pmax.
  500. +         cpu_type=mips
  501. +         target_machine=tm-decstatn-ae.h
  502.               ;;
  503.       apollo68)
  504.           cpu_type=m68k
  505.