Procedure for modifying GCC versions to add HLI support (1/6/97) ---------------------------------------------------------------- 0. ./configure GCC. This is explained in the INSTALL/README files that come with gcc. 1. Grab the HLI-specific C files and put them in your top-level GCC directory. Copying /project/csl07/glamm/gcc/gcc-2.7.2/*hli* should do the trick (this is all the .c and the .h files). 2. In the Makefile, around line 285, there is a line: EXTRA_OBJS = Add these to the end of the line: EXTRA_OBJS = hli-map.o read-hli-pp.o hli-region.o hli-query.o 3. Apply the diff at the end of this file to the gcc files (either by hand or using the patch utility - I use gcc 2.7.2, so applying other versions may give errors). 4. make LANGUAGES=c --- To run C code through GCC with HLI information: 5. Generate HLI info file from SUIF. Retain SUIF-generated C file. 6. Run HLI file through postprocessor (~glamm/suif/postprocess). 7. Run C program and HLI through SUIF. A) currently, you MUST use -O0 and -g. B) Specify the HLI file with -h C) HLI verbosity can be enabled with -y[AMPRir] Basically, i is itemtable, r is regiontable, (either one or the other must be specified), and MPR denote mapping, processing, or region-table specific messages (combined with i or r). -yA turns on EVERYTHING. Right now, the HLI doesn't do much - once the program is parsed and RTX-ified and the HLI info is mapped, hli_query() is called that allows interactive queries of the HLI information. --- An example script that invokes GCC: #!/bin/csh setenv GCC_BASEDIR /project/csl07/glamm/gcc/gcc-2.7.2 ${GCC_BASEDIR}/xgcc -B${GCC_BASEDIR} -O0 -g -dh $* ------------------------------- PATCH as mentioned above ------------------------------- diff -rc gcc-2.7.2.orig/config/mips/gnu.h gcc-2.7.2/config/mips/gnu.h *** gcc-2.7.2.orig/config/mips/gnu.h Mon Jun 19 12:42:19 1995 --- gcc-2.7.2/config/mips/gnu.h Thu Nov 7 13:22:27 1996 *************** *** 85,91 **** || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ || (CHAR) == 'I' || (CHAR) == 'm' \ || (CHAR) == 'h' || (CHAR) == 'z' \ ! || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'G') #undef DEFAULT_PCC_STRUCT_RETURN #define DEFAULT_PCC_STRUCT_RETURN 1 --- 85,91 ---- || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ || (CHAR) == 'I' || (CHAR) == 'm' \ || (CHAR) == 'h' || (CHAR) == 'z' \ ! || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'G' || (CHAR) == 'h') #undef DEFAULT_PCC_STRUCT_RETURN #define DEFAULT_PCC_STRUCT_RETURN 1 diff -rc gcc-2.7.2.orig/config/mips/mips.h gcc-2.7.2/config/mips/mips.h *** gcc-2.7.2.orig/config/mips/mips.h Thu Nov 9 10:23:09 1995 --- gcc-2.7.2/config/mips/mips.h Thu Nov 7 13:22:27 1996 *************** *** 483,489 **** ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \ || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ || (CHAR) == 'I' || (CHAR) == 'm' \ ! || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'G') /* Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro --- 483,489 ---- ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \ || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ || (CHAR) == 'I' || (CHAR) == 'm' \ ! || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'G' || (CHAR) == 'h') /* Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro diff -rc gcc-2.7.2.orig/gcc.c gcc-2.7.2/gcc.c *** gcc-2.7.2.orig/gcc.c Tue Sep 12 16:15:11 1995 --- gcc-2.7.2/gcc.c Thu Nov 7 17:17:15 1996 *************** *** 465,471 **** /* config.h can define CC1_SPEC to provide extra args to cc1 and cc1plus or extra switch-translations. */ #ifndef CC1_SPEC ! #define CC1_SPEC "" #endif /* config.h can define CC1PLUS_SPEC to provide extra args to cc1plus --- 465,471 ---- /* config.h can define CC1_SPEC to provide extra args to cc1 and cc1plus or extra switch-translations. */ #ifndef CC1_SPEC ! #define CC1_SPEC "%{h*}" #endif /* config.h can define CC1PLUS_SPEC to provide extra args to cc1plus *************** *** 553,559 **** ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \ || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \ ! || (CHAR) == 'L' || (CHAR) == 'A') #endif /* This defines which multi-letter switches take arguments. */ --- 553,559 ---- ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \ || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \ ! || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'h') #endif /* This defines which multi-letter switches take arguments. */ *************** *** 613,620 **** %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", "%{!M:%{!MM:%{!E:cc1 %{!pipe:%g.i} %1 \ ! %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a}\ ! %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\ %{aux-info*}\ %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ --- 613,620 ---- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", "%{!M:%{!MM:%{!E:cc1 %{!pipe:%g.i} %1 \ ! %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a} \ ! %{y*} %{h*} %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\ %{aux-info*}\ %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ *************** *** 795,800 **** --- 795,801 ---- {"--for-assembler", "-Wa", "a"}, {"--for-linker", "-Xlinker", "a"}, {"--force-link", "-u", "a"}, + {"--hli-file", "-h", "a"}, {"--imacros", "-imacros", "a"}, {"--include", "-include", "a"}, {"--include-barrier", "-I-", 0}, diff -rc gcc-2.7.2.orig/toplev.c gcc-2.7.2/toplev.c *** gcc-2.7.2.orig/toplev.c Fri Oct 20 16:56:35 1995 --- gcc-2.7.2/toplev.c Thu Nov 7 17:17:57 1996 *************** *** 62,67 **** --- 62,69 ---- #include "output.h" #include "bytecode.h" #include "bc-emit.h" + #include "hli-rtx.h" + #include "read-hli-pp.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" *************** *** 196,201 **** --- 198,214 ---- /* Flags saying which kinds of debugging dump have been requested. */ int rtl_dump = 0; + + /** HLI **/ + int hli_dump = 0; + + /** HLI verbosity flags **/ + int itemtable_verbose = 0; + int regiontable_verbose = 0; + int hliread_verbose = 0; + int hlimap_verbose = 0; + int hliprocess_verbose = 0; + int rtl_dump_and_exit = 0; int jump_opt_dump = 0; int cse_dump = 0; *************** *** 216,221 **** --- 229,238 ---- char *asm_file_name; + /* Name of hli input file */ + + char *process_file_name = NULL; + /* Value of the -G xx switch, and whether it was passed or not. */ int g_switch_value; int g_switch_set; *************** *** 747,752 **** --- 764,770 ---- FILE *asm_out_file; FILE *aux_info_file; FILE *rtl_dump_file; + FILE *hli_dump_file; FILE *jump_opt_dump_file; FILE *cse_dump_file; FILE *loop_dump_file; *************** *** 908,913 **** --- 926,933 ---- fflush (aux_info_file); if (rtl_dump_file) fflush (rtl_dump_file); + if (hli_dump_file) + fflush (hli_dump_file); if (jump_opt_dump_file) fflush (jump_opt_dump_file); if (cse_dump_file) *************** *** 2044,2049 **** --- 2064,2073 ---- if (rtl_dump) rtl_dump_file = open_dump_file (dump_base_name, ".rtl"); + /* if hli debug desired, open output file to stderr */ + if (hli_dump) + hli_dump_file = stderr; + /* If jump_opt dump desired, open the output file. */ if (jump_opt_dump) jump_opt_dump_file = open_dump_file (dump_base_name, ".jump"); *************** *** 2462,2467 **** --- 2486,2497 ---- if (rtl_dump) fclose (rtl_dump_file); + /* don't need close right now */ + #if 0 + if (hli_dump) + fclose (hli_dump_file); + #endif + if (jump_opt_dump) fclose (jump_opt_dump_file); *************** *** 2697,2702 **** --- 2727,2740 ---- insns = get_insns (); + /* read in the hli file */ + if(read_hli(decl_name(decl,NULL)) != 0) + { + hli_map(insns, 0); + hli_query(); + hli_unmap(); + } + /* Dump the rtl code if we are dumping rtl. */ if (rtl_dump) *************** *** 2819,2824 **** --- 2857,2865 ---- Also do it if -W, but in that case it doesn't change the rtl code, it only computes whether control can drop off the end of the function. */ + /* INSERTION - HLI to rtx mapper */ + /* hli_map(insns, 0); */ + if (optimize > 0 || extra_warnings || warn_return_type /* If function is `noreturn', we should warn if it tries to return. */ || TREE_THIS_VOLATILE (decl)) *************** *** 3456,3461 **** --- 3497,3503 ---- local_reg_dump = 1; loop_dump = 1; rtl_dump = 1; + hli_dump = 1; cse_dump = 1, cse2_dump = 1; sched_dump = 1; sched2_dump = 1; *************** *** 3476,3481 **** --- 3518,3526 ---- case 'g': global_reg_dump = 1; break; + case 'h': + hli_dump = 1; + break; case 'j': jump_opt_dump = 1; break; *************** *** 3802,3807 **** --- 3847,3886 ---- { asm_file_name = argv[++i]; } + else if (!strcmp (str, "h")) + { + process_file_name = argv[++i]; /* avoid =, get fname */ + } + else if (str[0] == 'y') + { + int ylc; + + for(ylc = 1; str[ylc]; ylc++) + { + switch(str[ylc]) + { + case 'i': + itemtable_verbose = 1; + break; + case 'r': + regiontable_verbose = 1; + break; + case 'R': + hliread_verbose = 1; + break; + case 'M': + hlimap_verbose = 1; + break; + case 'P': + hliprocess_verbose = 1; + break; + case 'A': + itemtable_verbose = regiontable_verbose = hliread_verbose = + hlimap_verbose = hliprocess_verbose = 1; + break; + } + } + } else if (str[0] == 'G') { g_switch_set = TRUE;