diff options
-rw-r--r-- | gcc/ChangeLog.MELT | 15 | ||||
-rw-r--r-- | gcc/Makefile.in | 17 | ||||
-rw-r--r-- | gcc/basic-block.h | 14 | ||||
-rw-r--r-- | gcc/basilys.c | 2 | ||||
-rw-r--r-- | gcc/compiler-probe.c | 2410 | ||||
-rw-r--r-- | gcc/compiler-probe.h | 451 | ||||
-rw-r--r-- | gcc/config.in | 6 | ||||
-rwxr-xr-x | gcc/configure | 156 | ||||
-rw-r--r-- | gcc/configure.ac | 71 | ||||
-rw-r--r-- | gcc/diagnostic.c | 6 | ||||
-rw-r--r-- | gcc/toplev.c | 17 | ||||
-rw-r--r-- | gcc/tree-flow-inline.h | 4 | ||||
-rw-r--r-- | gcc/tree-pass.h | 22 |
13 files changed, 37 insertions, 3154 deletions
diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT index aa63e49dfc8..928521b1aa2 100644 --- a/gcc/ChangeLog.MELT +++ b/gcc/ChangeLog.MELT @@ -1,3 +1,18 @@ +2009-06-16 Basile Starynkevitch <basile@starynkevitch.net> + [removed compile probe for pluginification after rev148523] + * compiler-probe.c: removed file. + * compiler-probe.h: removed file. + * basilys.c: don't include compiler-probe.h + * tree-pass.h: reverted to trunk. + * diagnostic.c: reverted to trunk. + * toplev.c: don't use compiler probe. + * configure.ac: ditto. removed --enable-compiler-probe. + * tree-flow-inline.h: reverted to trunk. + * basic-block.h: reverted to trunk & removed compiler probe. + * Makefile.in: removed compiler-probe.h + * config.in: likewise. + * configure: regenerated. + 2009-06-15 Basile Starynkevitch <basile@starynkevitch.net> [funmatcher expressions not working] * testsuite/melt/tfunmatch-1.melt: added funmatcher expr... diff --git a/gcc/Makefile.in b/gcc/Makefile.in index bc537951dc2..0b182008a3a 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -180,8 +180,6 @@ mips-tfile.o-warn = -Wno-error ## basilys.c contains tricky stuff basilys.o-warn = -Wno-error -## compiler-probe.o stuff -compiler-probe.o-warn = -Wno-error # All warnings have to be shut off in stage1 if the compiler used then # isn't gcc; configure determines that. WARN_CFLAGS will be either @@ -1389,12 +1387,8 @@ ALL_HOST_OBJS = $(GCC_OBJS) $(C_OBJS) $(OBJS) libbackend.o \ mips-tfile.o mips-tdump.o \ $(GCOV_OBJS) $(GCOV_DUMP_OBJS) -## gcc/configure.ac may set COMPILER_PROBE_OBJECT to compiler-probe.o or may leave it empty -COMPILER_PROBE_OBJ = @COMPILER_PROBE_OBJECT@ -COMPILER_PROBE_C= $(patsubst %.o, $(srcdir)/%.c, $(COMPILER_PROBE_OBJ)) -COMPILER_PROBE_H= $(patsubst %.o, $(srcdir)/%.h, $(COMPILER_PROBE_OBJ)) -BACKEND = main.o @TREEBROWSER@ $(COMPILER_PROBE_OBJ) libbackend.a $(CPPLIB) $(LIBDECNUMBER) +BACKEND = main.o @TREEBROWSER@ libbackend.a $(CPPLIB) $(LIBDECNUMBER) ## gcc/configure.ac may set BASILYSMELT_OBJECT to basilys.o or leave it empty BASILYSMELT_OBJ := @BASILYSMELT_OBJECT@ @@ -2542,14 +2536,6 @@ $(BASILYSMELT_OBJ): $(BASILYS_C) \ -DMELT_DEFAULT_MODLIS=\"$(melt_default_modules_list)\" \ -c $(BASILYS_C) $(OUTPUT_OPTION) endif - -ifdef COMPILER_PROBE_OBJ -$(COMPILER_PROBE_OBJ): $(COMPILER_PROBE_C) $(COMPILER_PROBE_H) \ - $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(REGS_H) $(TIMEVAR_H) \ - intl.h $(DIAGNOSTIC_H) $(HASHTAB_H) $(TREE_H) tree-pass.h $(TREE_FLOW_H) \ - $(TREE_DUMP_H) $(TREE_INLINE_H) tree-iterator.h $(DIAGNOSTIC_H) toplev.h \ - $(GGC_H) vec.h $(CGRAPH_H) $(FLAGS_H) $(BASIC_BLOCK_H) $(RTL_H) version.h -endif ### end of Basilys stuff bversion.h: s-bversion; @true @@ -3449,7 +3435,6 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/ipa-reference.c \ $(srcdir)/tree-ssa-structalias.c \ $(srcdir)/tree-ssa-alias.h \ - $(COMPILER_PROBE_C) \ $(BASILYS_C) \ @all_gtfiles@ diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 715fd839297..72bdf5c6504 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -335,20 +335,6 @@ enum bb_flags BB_NONTHREADABLE_BLOCK = 1 << 11 }; - -/* Basile adds a flag to accept RTL basic blocks in some special code - (like the compiler probe); declared in compiler-probe.h if enabled; - used to disable some asserts of BB_RTL flags in some - tree-flow-inline.h functons */ -#if ENABLE_COMPILER_PROBE -extern int comprobe_bb_ok_rtl; -#else -#define comprobe_bb_ok_rtl 0 -#endif /*ENABLE_COMPILER_PROBE*/ - - - - /* Dummy flag for convenience in the hot/cold partitioning code. */ #define BB_UNPARTITIONED 0 diff --git a/gcc/basilys.c b/gcc/basilys.c index c6c11f45046..250479cc397 100644 --- a/gcc/basilys.c +++ b/gcc/basilys.c @@ -58,8 +58,6 @@ extern const unsigned char executable_checksum[16]; #include "cppdefault.h" -#include "compiler-probe.h" - #include <dirent.h> diff --git a/gcc/compiler-probe.c b/gcc/compiler-probe.c deleted file mode 100644 index 516da2d570d..00000000000 --- a/gcc/compiler-probe.c +++ /dev/null @@ -1,2410 +0,0 @@ -/* Compiler probe - Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. - Contributed by Basile Starynkevitch <basile@starynkevitch.net> - -This file is part of GCC. - -GCC 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. - -GCC 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 GCC; see the file COPYING. If not, write to the Free -Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. */ - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "tm.h" -#include "regs.h" -#include "timevar.h" -#include "intl.h" -#include "diagnostic.h" -#include "hashtab.h" -#include "tree.h" -#include "tree-pass.h" -#include "tree-flow.h" -#include "tree-dump.h" -#include "tree-inline.h" -#include "tree-iterator.h" -#include "diagnostic.h" -#include "toplev.h" -#include "ggc.h" -#include "vec.h" -#include "cgraph.h" -#include "flags.h" -#include "options.h" -#include "safe-ctype.h" -#include "basic-block.h" -#include "rtl.h" -#include "version.h" - -#ifndef GCC_TREE_H -#error something is wrong should know about GCC_TREE_H -#endif - -#include "compiler-probe.h" - -#if !defined(ENABLE_COMPILER_PROBE) || ENABLE_COMPILER_PROBE==0 -/* this file is linked in only if the compiler probe is enabled at - configure time */ -#error messy configuration: compiler-probe.c compiled but not enabled -#endif - -const char *tree_code_names[] = { -#define DEFTREECODE(SYM, STRING, TYPE, NARGS) STRING, -#include "tree.def" -#undef DEFTREECODE - (char *) 0 -}; - - -#define debugeprintf_raw(Fmt,...) do{if (flag_compiler_probe_debug) \ - {fprintf(stderr, Fmt, ##__VA_ARGS__); fflush(stderr);}}while(0) -#define debugeprintf(Fmt,...) debugeprintf_raw("@!%s:%d: " Fmt "\n", \ - basename(__FILE__), __LINE__, ##__VA_ARGS__) -/* some debugeprintf give warnings so I disable them */ -#define nodebugeprintf(Fmt,...) do {}while(0) - -/* #define nodebugprintf debugprintf */ - -#if ! defined( SIGCHLD ) && defined( SIGCLD ) -# define SIGCHLD SIGCLD -#endif - -/* set this flag on SIGIO */ -volatile sig_atomic_t comprobe_interrupted; - -int comprobe_bb_ok_rtl; /* declared in basic-block.h */ - -/* the probe command process */ -pid_t comprobe_pid; -/* the command stream piped into the compiler probe process */ -FILE *comprobe_replf; -/* the file descriptor for requests from the probe process; it is never 0 */ -int comprobe_reqfd; - - - -/* grace delay in milliseconds for the compiler probe */ -#define PROBE_GRACE_DELAY_MS 250 - - -struct proberequest_buffer_st -{ - unsigned len; - unsigned used; - char str[1]; /* actual size is len, zero-terminated */ -}; -/* the buffer above is allocate in multiple of (should be a power of 2) : */ -#define PROBUF_GRAN 0x1000 -static struct proberequest_buffer_st *proberequest_buf; - - -/* hash table for requests (from probe to compiler) handlers contain entries like */ -struct proberequesthentry_st -{ - const char *verb; /* strdup-ed */ - void *data; /* explicitly allocated & freed by caller */ - comprobe_requestfun_t *rout; -}; - -static htab_t proberequest_htable; - - -/* filename are e.g. unix paths */ -typedef const char *filename_t; -/* hash table for filenames contain entries like */ -struct filenamehentry_st -{ - filename_t file; /* strdup-ed filename */ - int rank; /* strictly positive rank in filename vector */ -}; - -static htab_t filename_htable; - -/* *INDENT-OFF* */ -static GTY(()) VEC(tree,gc) *unique_tree_vector; -static GTY(()) VEC(gimple,gc) *unique_gimple_vector; -static GTY(()) VEC(basic_block,gc) *unique_bb_vector; -/* each tree of unique_tree_vector or basic_block of unique_bb_vector is - unique; we manage an hash table of indexes (>2) there. the index 0 - is HTAB_EMPTY_ENTRY, the index 1 is HTAB_DELETED_ENTRY, the index 2 - is for the seeked entry */ -static GTY (()) tree unique_seeked_tree; -static GTY (()) basic_block unique_seeked_bb; -static GTY (()) gimple unique_seeked_gimple; -/* *INDENT-ON* */ -/* hashtables of integer indexes into the unique_tree_vector & unique_bb_vector */ -static htab_t unique_tree_htable; -static htab_t unique_bb_htable; -static htab_t unique_gimple_htable; -#define HTAB_SEEKED_ENTRY ((PTR) 2) - -/*** -we would like to use vectors of filenames, but I cannot make them work - with GTY: - // see thread http://gcc.gnu.org/ml/gcc/2007-01/msg00172.html - DEF_VEC_P (filename_t); - DEF_VEC_ALLOC_P (filename_t,heap); // don't work - VEC(filename_t,heap) *file_vector; - the gengtype parser choke on this with an error: unidentified type -`filename_t' -****/ - -/* variable array of filenames */ -static struct -{ - int size; /* allocated size */ - int last; /* last used index */ - const char ** tab; -} files_varr; - -struct displaychoice_st -{ - long di_magic; -#define DI_MAGIC 2491573L - HOST_WIDE_INT di_data; - comprobe_infodisplay_fun_t *di_fun; - char di_msg[1]; /* duplicated display message - - longer than 1 */ -}; -typedef struct displaychoice_st *displaychoice_ptr_t; -/* *INDENT-OFF* */ -DEF_VEC_P (displaychoice_ptr_t); -DEF_VEC_ALLOC_P (displaychoice_ptr_t, heap); - -struct comprobe_infodisplay_st { - int idis_num; /* unique infodisplay number */ - int idis_choice; /* current display choice*/ - struct infopointhentry_st* idis_infp; /* the information point */ - VEC(displaychoice_ptr_t,heap) *idis_navig; /* the navigation vector */ - void*idis_data; /* client data */ - void (*idis_destroy)(struct comprobe_infodisplay_st*idi); /* destructor */ -}; - -typedef struct comprobe_infodisplay_st* infodisplay_ptr_t; -DEF_VEC_P(infodisplay_ptr_t); -DEF_VEC_ALLOC_P(infodisplay_ptr_t,heap); -static VEC(infodisplay_ptr_t,heap) *infodisplay_vector; - -/* the info point hashtable contains entries like : */ -struct infopointhentry_st -{ - int infp_filerank; /* file rank */ - int infp_lineno; /* line number */ - int infp_num; /* unique infopoint number */ - VEC(displaychoice_ptr_t,heap) *infp_dischvec; -}; -typedef struct infopointhentry_st *infopoint_ptr_t; -static htab_t infopoint_htable; -DEF_VEC_P (infopoint_ptr_t); -DEF_VEC_ALLOC_P (infopoint_ptr_t, heap); -VEC (infopoint_ptr_t, heap) * infopoint_vector; -/* *INDENT-ON* */ - -/* random data for multiline replies */ -static struct drand48_data randata; - - -/**** - * supporting functions for probe reply hashtable - *****/ -static hashval_t -hash_proberequest (const void *d) -{ - const struct proberequesthentry_st *p = - (const struct proberequesthentry_st *) d; - return htab_hash_string (p->verb); -} - -static int -eq_proberequest (const void *dx, const void *dy) -{ - const struct proberequesthentry_st *px = - (const struct proberequesthentry_st *) dx; - const struct proberequesthentry_st *py = - (const struct proberequesthentry_st *) dy; - return !strcmp (px->verb, py->verb); -} - -static void -del_proberequest (void *d) -{ - struct proberequesthentry_st *p = (struct proberequesthentry_st *) d; - gcc_assert (p && p->verb); - free (CONST_CAST(char*,p->verb)); - p->verb = NULL; -} - - - -/**** - * supporting functions for filename hashtable - *****/ -static hashval_t -hash_filename (const void *d) -{ - const struct filenamehentry_st *p = (const struct filenamehentry_st *) d; - return htab_hash_string (p->file); -} - -static int -eq_filename (const void *dx, const void *dy) -{ - const struct filenamehentry_st *px = (const struct filenamehentry_st *) dx; - const struct filenamehentry_st *py = (const struct filenamehentry_st *) dy; - return !strcmp (px->file, py->file); -} - -static void -del_filename (void *d) -{ - struct filenamehentry_st *p = (struct filenamehentry_st *) d; - gcc_assert (p && p->file && p->rank > 0); - free (CONST_CAST (char*, p->file)); - p->file = NULL; -} - -/**** - * supporting functions for infopoint hashtable - *****/ -static hashval_t -hash_infopoint (const void *d) -{ - const struct infopointhentry_st *ifp = - (const struct infopointhentry_st *) d; - return (hashval_t) (((long) (ifp->infp_filerank << 12)) ^ - ((long) ifp->infp_lineno)); -} - -static int -eq_infopoint (const void *dx, const void *dy) -{ - const struct infopointhentry_st *ifx = - (const struct infopointhentry_st *) dx; - const struct infopointhentry_st *ify = - (const struct infopointhentry_st *) dy; - return ifx->infp_lineno == ify->infp_lineno - && ifx->infp_filerank == ify->infp_filerank; -} - -/*** - * supporting functions for unique_tree_htable - ***/ -static hashval_t -hash_info_tree (const void *d) -{ - comprobe_ix_t lg = (comprobe_ix_t) d; - if ( (const void*) d == (const void*) HTAB_EMPTY_ENTRY - || (const void*) d == (const void*) HTAB_DELETED_ENTRY) - return (hashval_t) 0; - else if ( (const void*) d == (const void*) HTAB_SEEKED_ENTRY) - { - lg = (comprobe_ix_t) unique_seeked_tree; - return (hashval_t) (lg ^ (lg >> 10)); - }; - if (lg > 2 && unique_tree_vector - && lg < VEC_length (tree, unique_tree_vector)) - { - lg = (comprobe_ix_t) VEC_index (tree, unique_tree_vector, lg); - return (hashval_t) (lg ^ (lg >> 10)); - }; - return 0; -} - - -static int -eq_info_tree (const void *dx, const void *dy) -{ - comprobe_ix_t lx = (comprobe_ix_t) dx; - comprobe_ix_t ly = (comprobe_ix_t) dy; - comprobe_ix_t nbtree = 0; - tree tx = NULL_TREE, ty = NULL_TREE; - if (lx == ly) - return 1; - if (unique_tree_vector) - nbtree = VEC_length (tree, unique_tree_vector); - else - return 0; - if (lx == (comprobe_ix_t) HTAB_SEEKED_ENTRY) - tx = unique_seeked_tree; - else if (lx > 2 && lx < nbtree) - tx = VEC_index (tree, unique_tree_vector, lx); - if (ly == (comprobe_ix_t) HTAB_SEEKED_ENTRY) - ty = unique_seeked_tree; - else if (ly > 2 && ly < nbtree) - ty = VEC_index (tree, unique_tree_vector, ly); - return tx == ty && tx != NULL_TREE; -} - - -comprobe_ix_t -comprobe_unique_index_of_tree (tree tr) -{ - comprobe_ix_t trix = 0; - comprobe_ix_t l = 0, nbtree = 0; - void **sp = NULL; - if (tr == NULL_TREE) - return 0; - gcc_assert (unique_tree_vector - && VEC_length (tree, unique_tree_vector) > 2); - l = (comprobe_ix_t) HTAB_SEEKED_ENTRY; - nbtree = VEC_length (tree, unique_tree_vector); - unique_seeked_tree = tr; - sp = htab_find_slot (unique_tree_htable, &l, INSERT); - if (sp) - { - if (*sp != HTAB_EMPTY_ENTRY && *sp != HTAB_DELETED_ENTRY - && *sp != HTAB_SEEKED_ENTRY) - l = *(comprobe_ix_t *) (*sp); - else - l = 0; - if (l > 2) - { - gcc_assert (l < nbtree - && VEC_index (tree, unique_tree_vector, l) == tr); - trix = l; - } - else - { - VEC_safe_push (tree, gc, unique_tree_vector, tr); - trix = nbtree; - *(comprobe_ix_t *) (sp) = trix; - } - } - else /* failed to insert into unique_tree_htable */ - gcc_unreachable (); - return trix; -} - -tree -comprobe_tree_of_unique_index (comprobe_ix_t ix) -{ - unsigned nbtree = 0; - if (ix < 2 || !unique_tree_vector) - return 0; - nbtree = VEC_length (tree, unique_tree_vector); - if ((int) ix < (int) nbtree) - return VEC_index (tree, unique_tree_vector, ix); - return 0; -} - - - -/*** - * supporting functions for unique_bb_htable - ***/ -static hashval_t -hash_info_bb (const void *d) -{ - comprobe_ix_t lg = (comprobe_ix_t) d; - if ((const void*) d == (const void*) HTAB_EMPTY_ENTRY - || (const void*) d == (const void*) HTAB_DELETED_ENTRY) - return (hashval_t) 0; - else if ((const void*) d == (const void*) HTAB_SEEKED_ENTRY) - { - lg = (comprobe_ix_t) unique_seeked_bb; - return (hashval_t) (lg ^ (lg >> 10)); - } - else if (lg > 2 && unique_bb_vector - && lg < VEC_length (basic_block, unique_bb_vector)) - { - lg = (comprobe_ix_t) VEC_index (basic_block, unique_bb_vector, lg); - return (hashval_t) (lg ^ (lg >> 10)); - }; - return 0; -} - - -static int -eq_info_bb (const void *dx, const void *dy) -{ - comprobe_ix_t lx = (comprobe_ix_t) dx; - comprobe_ix_t ly = (comprobe_ix_t) dy; - long nbbb = 0; - basic_block bx = NULL, by = NULL; - if (lx == ly) - return 1; - if (unique_bb_vector) - nbbb = VEC_length (basic_block, unique_bb_vector); - else - return 0; - if (lx == (comprobe_ix_t) HTAB_SEEKED_ENTRY) - bx = unique_seeked_bb; - else if (lx > 2 && lx < nbbb) - bx = VEC_index (basic_block, unique_bb_vector, lx); - if (ly == (comprobe_ix_t) HTAB_SEEKED_ENTRY) - by = unique_seeked_bb; - else if (ly > 2 && ly < nbbb) - by = VEC_index (basic_block, unique_bb_vector, ly); - return bx == by && bx != NULL; -} - -/****@@@ ADDING****/ - -/*** - * supporting functions for unique_gimple_htable - ***/ -static hashval_t -hash_info_gimple (const void *d) -{ - comprobe_ix_t lg = (comprobe_ix_t) d; - if ((const void*) d == (const void*) HTAB_EMPTY_ENTRY - || (const void*) d == HTAB_DELETED_ENTRY) - return (hashval_t) 0; - else if ((const void*) d == (const void*) HTAB_SEEKED_ENTRY) - { - lg = (comprobe_ix_t) unique_seeked_gimple; - return (hashval_t) (lg ^ (lg >> 10)); - } - else if (lg > 2 && unique_gimple_vector - && lg < VEC_length (gimple, unique_gimple_vector)) - { - lg = (comprobe_ix_t) VEC_index (gimple, unique_gimple_vector, lg); - return (hashval_t) (lg ^ (lg >> 10)); - }; - return 0; -} - - -static int -eq_info_gimple (const void *dx, const void *dy) -{ - comprobe_ix_t lx = (comprobe_ix_t) dx; - comprobe_ix_t ly = (comprobe_ix_t) dy; - comprobe_ix_t nbgimple = 0; - gimple tx = NULL, ty = NULL; - if (lx == ly) - return 1; - if (unique_gimple_vector) - nbgimple = VEC_length (gimple, unique_gimple_vector); - else - return 0; - if (lx == (comprobe_ix_t) HTAB_SEEKED_ENTRY) - tx = unique_seeked_gimple; - else if (lx > 2 && lx < nbgimple) - tx = VEC_index (gimple, unique_gimple_vector, lx); - if (ly == (comprobe_ix_t) HTAB_SEEKED_ENTRY) - ty = unique_seeked_gimple; - else if (ly > 2 && ly < nbgimple) - ty = VEC_index (gimple, unique_gimple_vector, ly); - return tx == ty && tx != NULL; -} - - -comprobe_ix_t -comprobe_unique_index_of_gimple (gimple tr) -{ - comprobe_ix_t trix = 0; - comprobe_ix_t l = 0, nbgimple = 0; - void **sp = NULL; - if (tr == NULL) - return 0; - gcc_assert (unique_gimple_vector - && VEC_length (gimple, unique_gimple_vector) > 2); - l = (comprobe_ix_t) HTAB_SEEKED_ENTRY; - nbgimple = VEC_length (gimple, unique_gimple_vector); - unique_seeked_gimple = tr; - sp = htab_find_slot (unique_gimple_htable, &l, INSERT); - if (sp) - { - if (*sp != HTAB_EMPTY_ENTRY && *sp != HTAB_DELETED_ENTRY - && *sp != HTAB_SEEKED_ENTRY) - l = *(comprobe_ix_t *) (*sp); - else - l = 0; - if (l > 2) - { - gcc_assert (l < nbgimple - && VEC_index (gimple, unique_gimple_vector, l) == tr); - trix = l; - } - else - { - VEC_safe_push (gimple, gc, unique_gimple_vector, tr); - trix = nbgimple; - *(comprobe_ix_t *) (sp) = trix; - } - } - else /* failed to insert into unique_gimple_htable */ - gcc_unreachable (); - return trix; -} - -gimple -comprobe_gimple_of_unique_index (comprobe_ix_t ix) -{ - unsigned nbgimple = 0; - if (ix < 2 || !unique_gimple_vector) - return 0; - nbgimple = VEC_length (gimple, unique_gimple_vector); - if ((int) ix < (int) nbgimple) - return VEC_index (gimple, unique_gimple_vector, ix); - return 0; -} - - -/****@@@ ADDED****/ -/**** - * register a reply verb - ****/ -static void -comprobe_register_unchecked (const char *verb, - comprobe_requestfun_t * handler, void *data) -{ - struct proberequesthentry_st slot; - struct proberequesthentry_st **slotptr; - hashval_t h; - memset (&slot, 0, sizeof (slot)); - slot.verb = verb; - h = hash_proberequest (&slot); - slotptr = (struct proberequesthentry_st **) - htab_find_slot_with_hash (proberequest_htable, &slot, h, INSERT); - if (!slotptr) - fatal_error - ("compiler probe failed to register request verb %s (memory full): %m", - verb); - if (*slotptr == HTAB_EMPTY_ENTRY || (*slotptr) == HTAB_DELETED_ENTRY) - { - struct proberequesthentry_st *newslot; - newslot = - (struct proberequesthentry_st *) - xcalloc (sizeof (struct proberequesthentry_st), 1); - newslot->verb = xstrdup (verb); - newslot->rout = handler; - newslot->data = data; - *slotptr = newslot; - } - else - { - struct proberequesthentry_st *oldslot = *slotptr; - gcc_assert (!strcmp (oldslot->verb, verb)); - oldslot->rout = handler; - oldslot->data = data; - } -} - - -/**** - * register a verb (and check that it is alphanumerical) - ****/ -void -comprobe_register (const char *verb, comprobe_requestfun_t * handler, - void *data) -{ - const char *pc; - if (!verb) - return; - if (!ISALPHA (verb[0])) - fatal_error ("compiler probe: invalid verb %s to register", verb); - for (pc = verb + 1; *pc; pc++) - if (!ISALNUM (*pc) && *pc != '_') - fatal_error ("compiler probe: invalid verb %s to register", verb); - comprobe_register_unchecked (verb, handler, data); -} - - -/**** - * remove a registered verb @@@@@@ HAS TO BE CODED - ****/ -void -comprobe_unregister (const char *verb) -{ - gcc_assert (verb && *verb); - /* #warning to be written comprobe_unregister */ - fatal_error("comprobe_unregister %s @@ NOT IMPLEMENTED YET", verb); -} - - -void -comprobe_infopoint_add_display (int infoptrank, - comprobe_infodisplay_fun_t * dispfun, - const char *msg, HOST_WIDE_INT data) -{ - infopoint_ptr_t infp = NULL; - displaychoice_ptr_t dch = NULL; - size_t msgl = 0; - if (!comprobe_replf) - return; - debugeprintf ("infopoint_add_display infoptrank %d msg %s", infoptrank, - msg); - if (infoptrank < 0 || !infopoint_vector - || infoptrank >= (int) VEC_length (infopoint_ptr_t, infopoint_vector)) - return; - infp = VEC_index (infopoint_ptr_t, infopoint_vector, infoptrank); - nodebugeprintf ("infopoint_add_display infp %p msg %s dispfun %p", - infp, msg, (void *) dispfun); - if (!infp || !msg || !dispfun) - return; - msgl = strlen (msg); - gcc_assert (infp->infp_num == infoptrank); - dch = (displaychoice_ptr_t) xcalloc (sizeof (*dch) + msgl, 1); - dch->di_data = data; - dch->di_magic = DI_MAGIC; - dch->di_fun = dispfun; - memcpy (dch->di_msg, msg, msgl); - debugeprintf ("infopoint_add_display dch %p", (void *) dch); - VEC_safe_push (displaychoice_ptr_t, heap, infp->infp_dischvec, dch); -} - -void -comprobe_display_add_navigator (struct comprobe_infodisplay_st *idi, - comprobe_infodisplay_fun_t * navfun, - const char *msg, HOST_WIDE_INT data) -{ - displaychoice_ptr_t dch = NULL; - size_t msgl = 0; - gcc_assert (idi); - gcc_assert (msg); - if (!comprobe_replf) - return; - msgl = strlen (msg); - if (!idi->idis_navig) - idi->idis_navig = VEC_alloc (displaychoice_ptr_t, heap, 3); - dch = (displaychoice_ptr_t) xcalloc (sizeof (*dch) + msgl, 1); - dch->di_data = data; - dch->di_fun = navfun; - dch->di_magic = DI_MAGIC; - memcpy (dch->di_msg, msg, msgl); - nodebugeprintf ("add_navigator display %d navfun %p msg '%s'", - idi->idis_num, (void *) navfun, msg); - VEC_safe_push (displaychoice_ptr_t, heap, idi->idis_navig, dch); -} - - - -/**** - * the SIGIO and SIGCHLD signal handler just sets a flag - ****/ -static void -sig_interrupted (int sig) -{ - gcc_assert (sig != 0); - comprobe_interrupted = 1; -} - - -/**** - * Create the probing process and set up the pipes to it. - * Do not exchange anything yet - ****/ -static void -create_probe_process (void) -{ - /* the probe process */ - pid_t probpid; - /* the pipes from probe to gcc, and from gcc to probe */ - int pip2gcc[2], pip2probe[2]; - char const* progarg[5]; - if (comprobe_pid > 0 && comprobe_replf && comprobe_reqfd >= 0) - return; - /* we do not use the pex_* routines from liberty.h because the - compiler probe is quite specific to Linux and similar Unix - operating systems with SIGIO, select, .... (probably Solaris, - and recent *BSD should be ok) */ - pip2gcc[0] = pip2gcc[1] = -1; - pip2probe[0] = pip2probe[1] = -1; - if (pipe (pip2gcc) || pipe (pip2probe)) - fatal_error ("failed to create pipes for compiler probe: %m"); - probpid = fork (); - if (probpid == (pid_t) 0) - { - /* child process */ - int ifd; - signal (SIGIO, SIG_DFL); -#ifdef SIGSEGV - signal (SIGSEGV, SIG_DFL); -#endif -#ifdef SIGINT - signal (SIGINT, SIG_DFL); -#endif -#ifdef SIGTERM - signal (SIGTERM, SIG_DFL); -#endif -#ifdef SIGQUIT - signal (SIGQUIT, SIG_DFL); -#endif -#define perror_exit(Msg) do{perror(Msg); exit(1);}while(0) - /* write-pipe from probe to gcc is our stdout */ - if (pip2gcc[1] != STDOUT_FILENO) - { - if (dup2 (pip2gcc[1], STDOUT_FILENO) < 0) - perror_exit - ("comprobe child process failed to dup2 pipe to stdout to gcc"); - (void) close (pip2gcc[1]); - } - /* read-pipe from gcc to probe is our stdin */ - if (pip2probe[0] != STDIN_FILENO) - { - if (dup2 (pip2probe[0], STDIN_FILENO) < 0) - perror_exit - ("comprobe child process failed to dup2 pipe to stdin from gcc"); - (void) close (pip2probe[0]); - } - /* close useless fds in the child before exec */ - for (ifd = STDERR_FILENO + 1; ifd < 64; ifd++) - (void) close (ifd); - /* use sh -c for the compiler probe command */ - progarg[0] = "sh"; - progarg[1] = "-c"; - progarg[2] = compiler_probe_string; - progarg[3] = (char *) 0; - execv ("/bin/sh", CONST_CAST(char**,progarg)); - perror_exit ("comprobe child process failed to exec /bin/sh"); - } -#undef perror_exit - else if (probpid < (pid_t) 0) - { - /* error fork failed */ - fatal_error ("failed to fork for compiler probe: %m"); - } - else - { /* parent */ - (void) close (pip2gcc[1]); - (void) close (pip2probe[0]); - comprobe_pid = probpid; - comprobe_replf = fdopen (pip2probe[1], "a"); - comprobe_reqfd = pip2gcc[0]; - if (!comprobe_replf) - fatal_error ("failed to open pipe stream to compiler probe: %m"); - if (comprobe_reqfd <= 0) - { - /* this should almost never happen; I could think it might - happen if gcc is run without any open file descriptor - not - even stdin; but I expect the request file descriptor to be - positive */ - fatal_error ("failed to get pipe fd %d from compiler probe: %m", - comprobe_reqfd); - }; - if (fcntl (comprobe_reqfd, F_SETFL, (long) O_NONBLOCK) < 0) - fatal_error - ("failed to make non-blocking the pipe fd %d from compiler probe: %m", - comprobe_reqfd); - if (fcntl (comprobe_reqfd, F_SETOWN, (long) getpid ()) < 0) - fatal_error ("failed to SETOWN pipe fd %d from compiler probe: %m", - comprobe_reqfd); - setlinebuf (comprobe_replf); - fprintf (stderr, "created compiler probe '%s' process %ld\n", - compiler_probe_string, (long) comprobe_pid); - } -} - - - -/**** - * wait for the compiler probe process, returns 0 when waited successfully; - * if BLOCKING is set, wait indefinitely, otherwise just test without - * blocking - ****/ -static int -wait_for_probe (int blocking, int *pstatus) -{ - int probstatus = 0; - gcc_assert (comprobe_pid > 0); -#if HAVE_WAITPID || HAVE_SYS_WAIT_H - if (waitpid (comprobe_pid, &probstatus, blocking ? WNOHANG : 0) == - comprobe_pid) - { - if (pstatus) - *pstatus = probstatus; - return 0; - } -#elif HAVE_WAIT4 - if (wait4 - (comprobe_pid, &probstatus, blocking ? WNOHANG : 0, - (struct rusage *) 0) == comprobepid) - { - if (pstatus) - *pstatus = probstatus; - return 0; - }; -#else -#error should have waitpid or wait4 -#endif - return 1; -} - -/**** - * output a string URL encoded wtih STR89' prefix for a string of 89 - * chars and a ' suffix - ****/ -void -comprobe_outenc_string (const char *s) -{ - int c, l; - if (!comprobe_replf || !s) - return; - l = strlen (s); - comprobe_printf ("STR%d'", l); - for (; (c = (*s)) != 0; s++) - { - if ((c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) - putc (c, comprobe_replf); - else - switch (c) - { - case ' ': - putc ('+', comprobe_replf); - break; - case '*': - case '/': - case '_': - case '@': - case '-': - case '(': - case ')': - case '!': - case '[': - case ']': - case '.': - case ',': - case ';': - putc (c, comprobe_replf); - break; - default: - fprintf (comprobe_replf, "%%%02x", c & 0xff); - break; - } - } - putc ('\'', comprobe_replf); -} - -/**** - * process a single line of request (from probe to compiler) - ****/ -static void -process_request_line (struct comprobe_whatpos_st *wp, char *line) -{ - struct proberequesthentry_st *ptrslot; - struct proberequesthentry_st slot; - char *pc; - char *argreq; - if (line[0] == '#' || line[0] == 0) - return; - debugeprintf ("req.lin: %s", line); - memset (&slot, 0, sizeof (slot)); - for (pc = line; ISALNUM (*pc) || *pc == '_'; pc++); - argreq = 0; - if (*pc) - argreq = pc + 1; - *pc = 0; - slot.verb = line; - ptrslot = - (struct proberequesthentry_st *) htab_find (proberequest_htable, &slot); - if (ptrslot && ptrslot->rout) - (*ptrslot->rout) (wp, argreq, ptrslot->data); - else - fprintf (stderr, "gcc compiler-probe don't understand request: %s\n", - line); - debugeprintf ("req.lin done: %s", line); -} - -/**** - * stop the compiler probe - ****/ -void -comprobe_stop (void) -{ - int status = 0; - if (!compiler_probe_string || !compiler_probe_string[0] || !comprobe_pid) - return; - /* kill the probing process and wait for it nicely, first by closing the pipe to it */ - fclose (comprobe_replf); - close (comprobe_reqfd); - /* give a little time to the probe */ - usleep ((unsigned long) PROBE_GRACE_DELAY_MS * 1000); - if (wait_for_probe (0, &status)) - { - (void) kill (comprobe_pid, SIGTERM); - while (!wait_for_probe (1, &status)) - { - usleep ((unsigned long) PROBE_GRACE_DELAY_MS * 1000); - (void) kill (comprobe_pid, SIGQUIT); - }; - }; - fprintf (stderr, "ended compiler probe process %ld [status %d]:", - (long) comprobe_pid, status); - if (WIFEXITED (status)) - fprintf (stderr, "probe exited %d\n", WEXITSTATUS (status)); - else if (WIFSIGNALED (status)) - psignal (WTERMSIG (status), - WCOREDUMP (status) - ? "probe coredumped on signal" : "probe terminated with signal"); - putc ('\n', stderr); - fflush (stderr); - comprobe_reqfd = -1; - comprobe_replf = (FILE *) 0; - comprobe_pid = 0; - compiler_probe_string = 0; - signal (SIGIO, SIG_DFL); - signal (SIGCHLD, SIG_DFL); -} - -/* forced kill of probe - called only on unrecoverable errors */ -void -comprobe_forced_kill (void) -{ - if (!compiler_probe_string || !compiler_probe_string[0] - || !comprobe_pid || !comprobe_replf) - return; - fflush (comprobe_replf); - (void) kill (comprobe_pid, SIGTERM); - comprobe_stop (); -} - -/**** - * read all probe requests, waiting for them for a delay in milliseconds - * and process every newline terminated reply line - ****/ -static void -read_probe_requests (struct comprobe_whatpos_st *wp, unsigned millisec) -{ - fd_set rdset; - struct timeval tv; - int maxfd = 0; - int selnb = 0; - if (comprobe_reqfd <= 0) - return; - /* flush the reply stream to send any pending stuff */ - if (comprobe_replf) - fflush (comprobe_replf); - FD_ZERO (&rdset); - if (comprobe_reqfd >= 0) - FD_SET (comprobe_reqfd, &rdset); - maxfd = MAX (maxfd, comprobe_reqfd); - if (millisec >= 1000) - millisec = 999; - tv.tv_sec = 0; - tv.tv_usec = millisec * 1000; - selnb = select (maxfd + 1, &rdset, (fd_set *) 0, (fd_set *) 0, &tv); - if (selnb > 0 && FD_ISSET (comprobe_reqfd, &rdset)) - { - int again = 0; - do - { - int newsiz; - int readcnt, readlen; - if (comprobe_reqfd < 0) - break; - newsiz = 0; - if (!proberequest_buf) - newsiz = 2 * PIPE_BUF; - else if (proberequest_buf->used + PIPE_BUF <= proberequest_buf->len) - newsiz = - (((5 * proberequest_buf->len / 4 + 2 * PIPE_BUF)) - | (PROBUF_GRAN - 1)) + 1; - if (newsiz > 0) - { - struct proberequest_buffer_st *newbuf; - newbuf = (struct proberequest_buffer_st *) - xcalloc (1, - sizeof (struct proberequest_buffer_st) + newsiz - 1); - newbuf->len = newsiz; - if (proberequest_buf) - { - gcc_assert (proberequest_buf->used <= - proberequest_buf->len); - memcpy (newbuf->str, proberequest_buf->str, - proberequest_buf->used); - newbuf->used = proberequest_buf->used; - free (proberequest_buf); - }; - proberequest_buf = newbuf; - }; - gcc_assert (proberequest_buf->used + PIPE_BUF < - proberequest_buf->len); - readlen = proberequest_buf->len - proberequest_buf->used - 1; - readcnt = read (comprobe_reqfd, - proberequest_buf->str + proberequest_buf->used, - readlen); - again = 0; - if (readcnt == 0) - { /* got end of file on the probe reply pipe */ - again = 0; - comprobe_stop (); - } - else if (readcnt < 0) - { - if (errno == EINTR) - again = 1; - else if (errno == EAGAIN) - again = 0; - else - fatal_error ("unexpected read error from compiler probe: %m"); - } - else /*readcnt>0 */ - { - char *eol = 0; - char *pc = 0; - off_t off, rlen; - proberequest_buf->used += readcnt; - proberequest_buf->str[proberequest_buf->used] = 0; - for (pc = proberequest_buf->str; (eol = strchr (pc, '\n')) != 0; - pc = eol + 1) - { - *eol = 0; - process_request_line (wp, pc); - if (comprobe_replf) - fflush (comprobe_replf); - }; - off = pc - proberequest_buf->str; - if (off > 0) - { - rlen = proberequest_buf->str + proberequest_buf->used - pc; - memmove (proberequest_buf->str, pc, rlen); - proberequest_buf->str[rlen] = 0; - proberequest_buf->used = rlen; - if (proberequest_buf->len - rlen > 3 * PIPE_BUF) - { - unsigned newsiz = - ((rlen + 2 * PIPE_BUF) | (PROBUF_GRAN - 1)) + 1; - if (newsiz < proberequest_buf->len && newsiz > rlen) - { - proberequest_buf = (struct proberequest_buffer_st *) - xrealloc (proberequest_buf, newsiz); - proberequest_buf->len = newsiz; - } - } - }; - again = 1; - } - } - while (again); - } -} - -/**** - * handle a request (called by comprobe_check macro) - ****/ -void -comprobe_handle_probe (const char *what, const char *file, int lineno) -{ - struct comprobe_whatpos_st wp; - if (!compiler_probe_string || !compiler_probe_string[0] - || comprobe_pid <= 0) - return; - memset (&wp, 0, sizeof (wp)); - wp.wp_what = what; - wp.wp_file = file; - wp.wp_line = lineno; - read_probe_requests (&wp, 0); -} - -/**** - * handle all requests until a given variable is cleared, or the probe ended - ****/ -void -comprobe_while_probe (const char *what, const char *file, int lineno, - int *pvar) -{ - struct comprobe_whatpos_st wp; - if (comprobe_pid <= 0 || !pvar) - return; - memset (&wp, 0, sizeof (wp)); - wp.wp_what = what; - wp.wp_file = file; - wp.wp_line = lineno; - while (comprobe_pid > 0 && *pvar) - { - read_probe_requests (&wp, PROBE_GRACE_DELAY_MS); - }; -} - -/*** - * big commands are uniquely bracketed - ***/ -static long leftcode, rightcode; -void -comprobe_begin_big (void) -{ - gcc_assert (leftcode == 0 && rightcode == 0); - if (!comprobe_replf) - return; - do - { - leftcode = lrand48 (); - } - while (leftcode == 0); - do - { - rightcode = lrand48 (); - } - while (rightcode == 0); - fprintf (comprobe_replf, "\n!#%x/%X[\n", - (int) (leftcode & 0xfffffff), (int) (rightcode & 0xfffffff)); -} - -void -comprobe_end_big (void) -{ - gcc_assert (leftcode != 0 && rightcode != 0); - if (comprobe_replf) - { - fprintf (comprobe_replf, "\n!#%x/%X]\n", - (int) (leftcode & 0xfffffff), (int) (rightcode & 0xfffffff)); - fflush (comprobe_replf); - } - leftcode = rightcode = 0; -} - - -static int nonstopped; - -/* the STOP request from probe stops properly the probe */ -static void -stop_reqfun (struct comprobe_whatpos_st *wp ATTRIBUTE_UNUSED, - char *reqlin ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED) -{ - if (comprobe_replf) - fflush (comprobe_replf); - nonstopped = 0; - comprobe_stop (); -} - -static int -cmp_displaychoice_ptr (const void *x, const void *y) -{ - const displaychoice_ptr_t dx = *(const displaychoice_ptr_t *) x; - const displaychoice_ptr_t dy = *(const displaychoice_ptr_t *) y; - return strcmp (dx->di_msg, dy->di_msg); -} - -/* the NEWINFODIALOG request from probe make a new dialog for an infopoint */ -static void -newinfodialog_reqfun (struct comprobe_whatpos_st *wp ATTRIBUTE_UNUSED, - char *reqlin, void *data ATTRIBUTE_UNUSED) -{ - int infork = -1, dialrk = -1, nbdisp = 0, chix = 0; - infopoint_ptr_t ip = NULL; - infodisplay_ptr_t idisp = NULL; - if (!comprobe_replf) - return; - debugeprintf ("newinfodialog_reqfun reqlin: %s", reqlin); - if (sscanf (reqlin, " pt: %d dia: %d", &infork, &dialrk) < 2 - || infork < 0 || dialrk < 0) - return; - debugeprintf ("newinfodialog_reqfun infork=%d dialrk=%d", infork, dialrk); - if (infork >= (int) VEC_length (infopoint_ptr_t, infopoint_vector)) - return; - ip = VEC_index (infopoint_ptr_t, infopoint_vector, infork); - if (!ip) - return; - if ((int) VEC_length (infodisplay_ptr_t, infodisplay_vector) <= dialrk) - VEC_safe_grow_cleared (infodisplay_ptr_t, heap, infodisplay_vector, - 5 * dialrk / 4 + 16); - idisp = (infodisplay_ptr_t) xcalloc (sizeof (*idisp), 1); - idisp->idis_num = dialrk; - idisp->idis_infp = ip; - VEC_replace (infodisplay_ptr_t, infodisplay_vector, dialrk, idisp); - /* sort the display choices in alphanumerical order */ - if (ip->infp_dischvec) - nbdisp = VEC_length (displaychoice_ptr_t, ip->infp_dischvec); - debugeprintf ("newinfodialog_reqfun nbdisp=%d", nbdisp); - if (nbdisp > 0) - qsort ((VEC_address (displaychoice_ptr_t, ip->infp_dischvec)), - (size_t) nbdisp, sizeof (displaychoice_ptr_t), - cmp_displaychoice_ptr); - for (chix = 0; chix < nbdisp; chix++) - { - displaychoice_ptr_t dch = - VEC_index (displaychoice_ptr_t, ip->infp_dischvec, chix); - gcc_assert (dch && dch->di_fun); - gcc_assert (dch->di_magic == DI_MAGIC); - comprobe_printf ("PROB_dialogchoice dia:%d msg:", dialrk); - comprobe_outenc_string (dch->di_msg); - comprobe_printf (" ch:%d\n", chix); - }; - comprobe_printf ("PROB_showdialog dia:%d\n", dialrk); - comprobe_flush (); -} - -static void bb_starting_displayer (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, HOST_WIDE_INT navig); - -static void tree_starting_displayer (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, HOST_WIDE_INT navig); - -static void gimple_starting_displayer (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, - HOST_WIDE_INT navig); - - -static void -display_tree (tree tr, struct comprobe_infodisplay_st *di) -{ - gcc_assert (di != 0); - debugeprintf ("display_tree tr %p code %d", (void *) tr, - tr ? TREE_CODE (tr) : 0); - if (!tr) - comprobe_printf ("*** NULL TREE %p ***\n", (void *) tr); - else if (EXPR_P (tr)) - { - debugeprintf ("display_tree tr %p expr", (void *) tr); - comprobe_printf ("*** EXPR %p ***\n", (void *) tr); - print_generic_expr (comprobe_replf, tr, - TDF_LINENO | TDF_VOPS | TDF_MEMSYMS); - } - else if (TREE_CODE (tr) == STATEMENT_LIST) - { - tree_stmt_iterator tsi; - int rk = 0; - debugeprintf ("display_tree tr %p stmtlist", (void *) tr); - comprobe_printf ("*** STATEMENT LIST %p ***\n", (void *) tr); - print_generic_expr (comprobe_replf, tr, - TDF_LINENO | TDF_VOPS | TDF_MEMSYMS); - for (tsi = tsi_start (tr); !tsi_end_p (tsi); tsi_next (&tsi)) - { - tree stmt = tsi_stmt (tsi); - rk++; - debugeprintf ("display_tree stmt %p rk %d", (void *) stmt, rk); - if (stmt) - { - static char titbuf[64]; - memset (titbuf, 0, sizeof (titbuf)); - snprintf (titbuf, sizeof (titbuf) - 1, "%d-th tree substmt", - rk); - comprobe_display_add_navigator (di, tree_starting_displayer, - titbuf, - comprobe_unique_index_of_tree - (stmt)); - } - - } - } - else - comprobe_printf ("*** tree of code %d <%s>***\n", - TREE_CODE (tr), tree_code_names[TREE_CODE (tr)]); -} - -static void -display_gimple_seq (gimple_seq sq, struct comprobe_infodisplay_st *di) -{ - gimple_stmt_iterator gsi; - int rk = 0; - debugeprintf ("display_gimple_seq sq %p", (void *) sq); - for (gsi = gsi_start (sq); !gsi_end_p (gsi); gsi_next (&gsi)) - { - char titbuf[64]; - gimple s = gsi_stmt (gsi); - memset (titbuf, 0, sizeof (titbuf)); - rk++; - debugeprintf ("display_gimple_seq s=%p rk=%d", (void *) s, rk); - snprintf (titbuf, sizeof (titbuf) - 1, "%d-th gimple substmt", rk); - comprobe_display_add_navigator (di, gimple_starting_displayer, - titbuf, - comprobe_unique_index_of_gimple (s)); - } -} - -static void -display_gimple (gimple g, struct comprobe_infodisplay_st *di) -{ - gcc_assert (di != 0); - debugeprintf ("display_gimple g %p", (void *) g); - if (!g) - { - comprobe_printf ("*** NULL GIMPLE %p ***\n", (void *) g); - return; - } - print_gimple_stmt (comprobe_replf, g, 1, - TDF_LINENO | TDF_VOPS | TDF_MEMSYMS); - if (gimple_has_substatements (g)) - { - switch (gimple_code (g)) - { - case GIMPLE_BIND: - display_gimple_seq (gimple_bind_body (g), di); - break; - case GIMPLE_CATCH: - display_gimple_seq (gimple_catch_handler (g), di); - break; - case GIMPLE_EH_FILTER: - display_gimple_seq (gimple_eh_filter_failure (g), di); - break; - case GIMPLE_TRY: - display_gimple_seq (gimple_try_eval (g), di); - display_gimple_seq (gimple_try_cleanup (g), di); - break; - case GIMPLE_WITH_CLEANUP_EXPR: - display_gimple_seq (gimple_wce_cleanup (g), di); - break; - case GIMPLE_OMP_FOR: - case GIMPLE_OMP_MASTER: - case GIMPLE_OMP_ORDERED: - case GIMPLE_OMP_SECTION: - case GIMPLE_OMP_PARALLEL: - case GIMPLE_OMP_TASK: - case GIMPLE_OMP_SECTIONS: - case GIMPLE_OMP_SINGLE: - { - static bool warned; - if (!warned) - { - warning (0, - "compiler probe not implemented for OpenMP stuff"); - warned = true; - } - return; - } - break; - default: - gcc_unreachable (); - } - } -} - - -static void -gimple_starting_displayer (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, - HOST_WIDE_INT navig ATTRIBUTE_UNUSED) -{ - gimple g = 0; - comprobe_ix_t ix = (comprobe_ix_t) data; - unsigned nbgimple = VEC_length (gimple, unique_gimple_vector); - debugeprintf ("gimple_starting_displayer ix %d nbgimple %d", (int) ix, - (int) nbgimple); - if (ix > 0 && ix < (long) nbgimple) - { - g = VEC_index (gimple, unique_gimple_vector, ix); - debugeprintf ("gimple_starting_displayer g %p", (void *) g); - comprobe_printf - ("// starting gimple_%ld #%d shown when '%s' \n// from gcc file %s line %d\n", - ix, di->idis_infp->infp_num, wp->wp_what, basename (wp->wp_file), - wp->wp_line); - display_gimple (g, di); - } - else - { - debugeprintf ("gimple_starting_displayer bad ix %d nbgimple %d", - (int) ix, (int) nbgimple); - comprobe_printf - (" ?? invalid starting gimple index %ld nbgimple %d info #%d??", - (long) ix, (int) nbgimple, di->idis_infp->infp_num); - } -} - -static void -tree_starting_displayer (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, - HOST_WIDE_INT navig ATTRIBUTE_UNUSED) -{ - tree tr = NULL_TREE; - comprobe_ix_t ix = (comprobe_ix_t) data; - unsigned nbtree = VEC_length (tree, unique_tree_vector); - debugeprintf ("tree_starting_displayer ix %d nbtree %d", (int) ix, - (int) nbtree); - if (ix > 0 && ix < (long) nbtree) - { - tr = VEC_index (tree, unique_tree_vector, ix); - debugeprintf ("tree_starting_displayer ix %d tr %p", (int) ix, - (void *) tr); - comprobe_printf - ("// starting tree_%ld #%d shown when '%s' \n// from gcc file %s line %d\n", - ix, di->idis_infp->infp_num, wp->wp_what, basename (wp->wp_file), - wp->wp_line); - display_tree (tr, di); - } - else - { - debugeprintf ("tree_starting_displayer ix %d bad", (int) ix); - comprobe_printf - (" ?? invalid starting tree index %ld nbtree %d info #%d??", - (long) ix, (int) nbtree, di->idis_infp->infp_num); - } -} - -#if 0 /* unused function */ -static void -tree_ending_displayer (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, - HOST_WIDE_INT navig ATTRIBUTE_UNUSED) -{ - tree tr = NULL_TREE; - comprobe_ix_t ix = (comprobe_ix_t) data; - unsigned nbtree = VEC_length (tree, unique_tree_vector); - debugeprintf ("tree_ending_displayer ix %d nbtree %d", (int) ix, - (int) nbtree); - if (ix > 0 && ix < (long) nbtree) - { - tr = VEC_index (tree, unique_tree_vector, ix); - debugeprintf ("tree_ending_displayer tr %p ix %d", (void *) tr, - (int) ix); - comprobe_printf - ("// ending tree_%ld #%d shown when '%s'\n// from gcc file %s line %d\n", - (long) ix, di->idis_infp->infp_num, wp->wp_what, - basename (wp->wp_file), wp->wp_line); - display_tree (tr, di); - } - else - { - debugeprintf ("tree_ending_displayer ix %d bad", (int) ix); - comprobe_printf - (" ?? invalid ending tree index %ld nbtree %d info #%d??", (long) ix, - (int) nbtree, di->idis_infp->infp_num); - } -} -#endif - -static void -bb_starting_displayer (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, - HOST_WIDE_INT navig ATTRIBUTE_UNUSED) -{ - comprobe_ix_t ix = (comprobe_ix_t) data; - char pfx[24]; - basic_block bb = NULL; - debugeprintf ("bb_starting_displayer ix %d", (int) ix); - comprobe_bb_ok_rtl = 1; - if (ix > 0 && ix < VEC_length (basic_block, unique_bb_vector)) - { - bb = VEC_index (basic_block, unique_bb_vector, ix); - debugeprintf ("bb_starting_displayer bb %p #%d ix%d", (void *) bb, - bb ? bb->index : -1, (int) ix); - if (flag_compiler_probe_debug) - dump_bb (bb, stderr, 0); - comprobe_printf - ("// starting basic block _%ld #%d shown when '%s' \n// from gcc file %s line %d\n", - (long) ix, di->idis_infp->infp_num, wp->wp_what, - basename (wp->wp_file), wp->wp_line); - snprintf (pfx, sizeof (pfx), "[+bb#%d] ", di->idis_infp->infp_num); - comprobe_printf ("\n// basic block info _%ld #%d is\n", - (long) ix, di->idis_infp->infp_num); - dump_bb_info (bb, true, true, - TDF_DETAILS | TDF_LINENO | TDF_VOPS | TDF_MEMSYMS, - pfx, comprobe_replf); - /* phi_nodes is not always valid so we don't display it */ - debugeprintf ("bb_starting_displayer again bb %p", (void *) bb); - /* basic blocks [almost?] always have statements */ - { - gimple_stmt_iterator gsi; - comprobe_printf ("\n// basic block statements _%ld #%d is\n", ix, - di->idis_infp->infp_num); - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple g = gsi_stmt (gsi); - display_gimple (g, di); - comprobe_display_add_navigator - (di, gimple_starting_displayer, - "stmt", comprobe_unique_index_of_gimple (g)); - } - } - } - else - { - debugeprintf ("bb_starting_displayer bb bad ix %d", (int) ix); - comprobe_printf ("?? invalid starting basic block index %ld info #%d??", - ix, di->idis_infp->infp_num); - } - comprobe_bb_ok_rtl = 0; -} - -static void -bb_ending_displayer (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, HOST_WIDE_INT navig ATTRIBUTE_UNUSED) -{ - comprobe_ix_t ix = (comprobe_ix_t) data; - char pfx[24]; - basic_block bb = NULL; - int infoptrk = di->idis_infp->infp_num; - debugeprintf ("bb_ending_displayer ix %d", (int) ix); - comprobe_bb_ok_rtl = 1; - if (ix > 0 && ix < VEC_length (basic_block, unique_bb_vector)) - { - bb = VEC_index (basic_block, unique_bb_vector, ix); - debugeprintf ("bb_ending_displayer bb %p #%d", (void *) bb, - bb ? bb->index : -1); - if (flag_compiler_probe_debug) - dump_bb (bb, stderr, 0); - comprobe_printf - ("// ending basic block _%ld #%d shown when '%s'\n// from gcc file %s line %d\n", - ix, infoptrk, wp->wp_what, basename (wp->wp_file), wp->wp_line); - snprintf (pfx, sizeof (pfx), "[-bb#%d] ", infoptrk); - dump_bb_info (bb, true, true, - TDF_DETAILS | TDF_LINENO | TDF_VOPS | TDF_MEMSYMS, - pfx, comprobe_replf); - } - else - comprobe_printf ("?? invalid ending basic block index %ld info #%d??", ix, - infoptrk); - comprobe_bb_ok_rtl = 0; -} - -/* clear the navigation vector inside a display */ -static void -infodialog_clear_navig (infodisplay_ptr_t disp) -{ - int navix = 0; - displaychoice_ptr_t navch = NULL; - debugeprintf ("infodialog_clear_navig disp %p num %d", (void *) disp, - disp->idis_num); - if (disp->idis_navig) - { - for (navix = 0; - VEC_iterate (displaychoice_ptr_t, disp->idis_navig, navix, - navch); navix++) - { - if (!navch) - continue; - gcc_assert (navch->di_magic == DI_MAGIC); - VEC_replace (displaychoice_ptr_t, disp->idis_navig, navix, NULL); - memset (navch, 0, sizeof (navch)); - free (navch); - } - VEC_free (displaychoice_ptr_t, heap, disp->idis_navig); - disp->idis_navig = NULL; - } -} - - -static void -fill_infodialog (struct comprobe_whatpos_st *wp, infodisplay_ptr_t disp, - displaychoice_ptr_t ch, comprobe_ix_t chix) -{ - debugeprintf ("fill_infodialog ch %p chix %d", (void *) ch, (int) chix); - gcc_assert (ch && ch->di_magic == DI_MAGIC); - infodialog_clear_navig (disp); - if (ch->di_fun) - { - comprobe_begin_big_printf ("PROB_dialogcontent dia:%d\n", - disp->idis_num); - (*ch->di_fun) (wp, disp, ch->di_data, chix); - comprobe_end_big (); - if (disp->idis_navig - && VEC_length (displaychoice_ptr_t, disp->idis_navig) > 0) - { - int navix = 0; - displaychoice_ptr_t navch = NULL; - for (navix = 0; - VEC_iterate (displaychoice_ptr_t, disp->idis_navig, navix, - navch); navix++) - { - gcc_assert (navch->di_magic == DI_MAGIC); - debugeprintf ("fill_infodialog %d navix %d navch msg '%s'", - disp->idis_num, navix, navch->di_msg); - comprobe_printf ("PROB_dialognavig dia:%d msg:", - disp->idis_num); - comprobe_outenc_string (navch->di_msg); - comprobe_printf (" nav:%d\n", navix); - } - } - comprobe_printf ("PROB_showdialog dia:%d\n", disp->idis_num); - comprobe_flush (); - } - else - debugeprintf ("fill_infodialog no function in ch %p", (void *) ch); -} - - -/* the SHOWINFODIALOG request from probe ask for the dialog to be shown */ -static void -showinfodialog_reqfun (struct comprobe_whatpos_st *wp, - char *reqlin, void *data ATTRIBUTE_UNUSED) -{ - int dialrk = -1, chrk = -1; - infodisplay_ptr_t disp = NULL; - infopoint_ptr_t ip = NULL; - displaychoice_ptr_t ch = NULL; - if (!comprobe_replf) - return; - debugeprintf ("showinfodialog_reqfun reqlin: %s", reqlin); - if (sscanf (reqlin, " dia: %d ch: %d", &dialrk, &chrk) < 2 - || chrk < 0 || dialrk < 0) - return; - if (!infodisplay_vector - || dialrk >= (int) VEC_length (infodisplay_ptr_t, infodisplay_vector)) - return; - disp = VEC_index (infodisplay_ptr_t, infodisplay_vector, dialrk); - if (!disp) - return; - gcc_assert (disp->idis_num == dialrk); - ip = disp->idis_infp; - gcc_assert (ip); - if (chrk >= (int) VEC_length (displaychoice_ptr_t, ip->infp_dischvec)) - return; - ch = VEC_index (displaychoice_ptr_t, ip->infp_dischvec, chrk); - if (!ch) - return; - gcc_assert (ch->di_magic == DI_MAGIC); - disp->idis_choice = chrk; - debugeprintf ("showinfodialog_reqfun ch %p str= %s", (void *) ch, - ch->di_msg); - fill_infodialog (wp, disp, ch, -1); - debugeprintf ("showinfodialog_reqfun end reqlin: %s", reqlin); -} - - -static void -updateinfodialog_reqfun (struct comprobe_whatpos_st *wp, - char *reqlin, void *data ATTRIBUTE_UNUSED) -{ - int dialrk = -1; - infodisplay_ptr_t disp = NULL; - infopoint_ptr_t ip = NULL; - displaychoice_ptr_t ch = NULL; - if (!comprobe_replf) - return; - debugeprintf ("updateinfodialog_reqfun reqlin: %s", reqlin); - if (sscanf (reqlin, " dia: %d", &dialrk) <= 0 || dialrk < 0) - return; - if (!infodisplay_vector - || dialrk >= (int) VEC_length (infodisplay_ptr_t, infodisplay_vector)) - return; - disp = VEC_index (infodisplay_ptr_t, infodisplay_vector, dialrk); - if (!disp) - return; - gcc_assert (disp->idis_num == dialrk); - ip = disp->idis_infp; - if (disp->idis_choice >= 0 - && disp->idis_choice < - (int) VEC_length (displaychoice_ptr_t, ip->infp_dischvec)) - ch = - VEC_index (displaychoice_ptr_t, ip->infp_dischvec, disp->idis_choice); - if (!ch) - { - debugeprintf ("updateinfodialog_reqfun no ch %p", (void *) ch); - return; - }; - gcc_assert (ch->di_magic == DI_MAGIC); - debugeprintf ("updateinfodialog_reqfun ch %p str= %s", (void *) ch, - ch->di_msg); - fill_infodialog (wp, disp, ch, -1); - debugeprintf ("updateinfodialog_reqfun end reqlin: %s", reqlin); -} - -static void -naviginfodialog_reqfun (struct comprobe_whatpos_st *wp, - char *reqlin, void *data ATTRIBUTE_UNUSED) -{ - int dialrk = -1, navrk = -1; - infodisplay_ptr_t disp = NULL; - infopoint_ptr_t ip = NULL; - displaychoice_ptr_t ch = NULL; - if (!comprobe_replf) - return; - debugeprintf ("naviginfodialog_reqfun reqlin: %s", reqlin); - if (sscanf (reqlin, " dia: %d nav: %d", &dialrk, &navrk) <= 0 - || dialrk < 0 || navrk < 0) - return; - if (!infodisplay_vector - || dialrk >= (int) VEC_length (infodisplay_ptr_t, infodisplay_vector)) - return; - disp = VEC_index (infodisplay_ptr_t, infodisplay_vector, dialrk); - debugeprintf ("naviginfodialog_reqfun disp %p", (void *) disp); - if (!disp) - return; - gcc_assert (disp->idis_num == dialrk); - ip = disp->idis_infp; - if (navrk < (int) VEC_length (displaychoice_ptr_t, disp->idis_navig)) - ch = VEC_index (displaychoice_ptr_t, disp->idis_navig, navrk); - if (!ch) - return; - debugeprintf ("naviginfodialog_reqfun ch %p navrk %d", (void *) ch, navrk); - gcc_assert (ch->di_magic == DI_MAGIC); - debugeprintf ("naviginfodialog_reqfun ch %p str= %s", (void *) ch, - ch->di_msg); - fill_infodialog (wp, disp, ch, navrk); - debugeprintf ("naviginfodialog_reqfun end reqlin: %s\n", reqlin); -} - -static void -removeinfodialog_reqfun (struct comprobe_whatpos_st *wp ATTRIBUTE_UNUSED, - char *reqlin, void *data ATTRIBUTE_UNUSED) -{ - int dialrk = -1; - infodisplay_ptr_t disp = NULL; - if (!comprobe_replf) - return; - debugeprintf ("removeinfodialog_reqfun reqlin: %s", reqlin); - if (sscanf (reqlin, " dia: %d", &dialrk) <= 0 || dialrk < 0) - return; - if (!infodisplay_vector - || dialrk >= (int) VEC_length (infodisplay_ptr_t, infodisplay_vector)) - return; - disp = VEC_index (infodisplay_ptr_t, infodisplay_vector, dialrk); - if (!disp) - return; - gcc_assert (disp->idis_num == dialrk); - infodialog_clear_navig (disp); - free (disp); - VEC_replace (infodisplay_ptr_t, infodisplay_vector, dialrk, 0); - comprobe_printf ("PROB_destroydialog dia:%d\n", dialrk); - comprobe_flush (); - debugeprintf ("removeinfodialog_reqfun end reqlin: %s", reqlin); -} - -/**** - * send a message to be shown - ****/ -void -comprobe_show_message (const char *msg) -{ - if (!msg || !comprobe_replf) - return; - comprobe_puts ("PROB_message msg:"); - comprobe_outenc_string (msg); - comprobe_puts ("\n"); - comprobe_flush (); -} - - -/**** - * Initialize the probe. Called from toplev.c - ****/ -void -comprobe_initialize (void) -{ - static int inited; - long seed = 0; - const char *pc; - const char *randomseed = get_random_seed (false); - gcc_assert (!inited); - gcc_assert (randomseed != (char *) 0); - inited = 1; - if (!compiler_probe_string || !compiler_probe_string[0]) - return; - for (pc = randomseed; *pc; pc++) - seed ^= (seed << 5) + (*pc); - srand48_r ((long) seed, &randata); - signal (SIGIO, sig_interrupted); - signal (SIGCHLD, sig_interrupted); - proberequest_htable = - htab_create (113, hash_proberequest, eq_proberequest, del_proberequest); - filename_htable = - htab_create (229, hash_filename, eq_filename, del_filename); - infopoint_htable = htab_create (2081, hash_infopoint, eq_infopoint, NULL); - infopoint_vector = VEC_alloc (infopoint_ptr_t, heap, 2048); - unique_tree_vector = VEC_alloc (tree, gc, 1024); - unique_bb_vector = VEC_alloc (basic_block, gc, 512); - /* reserve but don't use the first 4 entries hence HTAB_SEEKED_ENTRY unused */ - VEC_safe_push (tree, gc, unique_tree_vector, (tree) 0); - VEC_safe_push (tree, gc, unique_tree_vector, (tree) 0); - VEC_safe_push (tree, gc, unique_tree_vector, (tree) 0); - VEC_safe_push (tree, gc, unique_tree_vector, (tree) 0); - VEC_safe_push (basic_block, gc, unique_bb_vector, (basic_block) 0); - VEC_safe_push (basic_block, gc, unique_bb_vector, (basic_block) 0); - VEC_safe_push (basic_block, gc, unique_bb_vector, (basic_block) 0); - VEC_safe_push (basic_block, gc, unique_bb_vector, (basic_block) 0); - VEC_safe_push (gimple, gc, unique_gimple_vector, (gimple) 0); - VEC_safe_push (gimple, gc, unique_gimple_vector, (gimple) 0); - VEC_safe_push (gimple, gc, unique_gimple_vector, (gimple) 0); - VEC_safe_push (gimple, gc, unique_gimple_vector, (gimple) 0); - unique_tree_htable = htab_create (4007, hash_info_tree, eq_info_tree, NULL); - unique_bb_htable = htab_create (3001, hash_info_bb, eq_info_bb, NULL); - unique_gimple_htable = - htab_create (6173, hash_info_gimple, eq_info_gimple, NULL); - files_varr.tab = XNEWVEC (char const*, 100); - files_varr.size = 100; - files_varr.last = 0; - memset (files_varr.tab, 0, sizeof (char **) * files_varr.size); - comprobe_register ("prob_NAVIGINFODIALOG", naviginfodialog_reqfun, - (void *) 0); - comprobe_register ("prob_NEWINFODIALOG", newinfodialog_reqfun, (void *) 0); - comprobe_register ("prob_REMOVEINFODIALOG", removeinfodialog_reqfun, - (void *) 0); - comprobe_register ("prob_SHOWINFODIALOG", showinfodialog_reqfun, - (void *) 0); - comprobe_register ("prob_STOP", stop_reqfun, (void *) 0); - comprobe_register ("prob_UPDATEINFODIALOG", updateinfodialog_reqfun, - (void *) 0); - create_probe_process (); - comprobe_printf ("PROB_version proto:%d msg:", COMPROBE_PROTOCOL_NUMBER); - comprobe_outenc_string (version_string); - comprobe_puts ("\n"); - comprobe_flush (); - atexit (comprobe_forced_kill); -} - -/**** - * Finish the probe. Called from toplev.c - ****/ -void -comprobe_finish (void) -{ - nonstopped = 1; - comprobe_puts ("PROB_message msg:"); - comprobe_outenc_string ("probe finished"); - comprobe_puts ("\n"); - comprobe_flush (); - comprobe_while ("finishing", &nonstopped); - comprobe_stop (); - if (proberequest_htable) - { - htab_empty (proberequest_htable); - htab_delete (proberequest_htable); - proberequest_htable = 0; - }; - if (filename_htable) - { - htab_empty (filename_htable); - htab_delete (filename_htable); - filename_htable = 0; - }; -} - - - -int -comprobe_file_rank (const char *filename) -{ - struct filenamehentry_st slot; - struct filenamehentry_st **slotptr = 0; - int filerank = 0; - - if (!filename || !comprobe_replf) - return 0; - memset (&slot, 0, sizeof (slot)); - slot.file = filename; - slotptr = (struct filenamehentry_st **) - htab_find_slot (filename_htable, &slot, INSERT); - if (!slotptr) - fatal_error - ("compiler probe failed to register file %s (memory full): %m", - filename); - if (*slotptr == HTAB_EMPTY_ENTRY || (*slotptr) == HTAB_DELETED_ENTRY) - { - struct filenamehentry_st *newslot = 0; - const char *dupfilename = xstrdup (filename); - newslot = (struct filenamehentry_st *) xcalloc (sizeof (*newslot), 1); - if (files_varr.last + 1 >= files_varr.size) - { - int newsiz = ((5 * files_varr.last) / 4 + 50) | 0x1f; - int ix; - const char **newarr = XNEWVEC (const char *, newsiz); - newarr[0] = 0; - for (ix = files_varr.last; ix > 0; ix--) - newarr[ix] = CONST_CAST(char*,files_varr.tab[ix]); - for (ix = files_varr.last + 1; ix < newsiz; ix++) - newarr[ix] = (char *) 0; - memset (files_varr.tab, 0, sizeof (char *) * files_varr.size); - XDELETEVEC (files_varr.tab); - files_varr.tab = CONST_CAST(const char**, newarr); - } - /* dont use index 0 */ - filerank = ++files_varr.last; - files_varr.tab[filerank] = (const char *) dupfilename; - gcc_assert (filerank > 0); - newslot->file = (const char *) dupfilename; - newslot->rank = filerank; - *slotptr = newslot; - debugeprintf ("new file rank filerank%d file %s newslot %p", filerank, - dupfilename, (void *) newslot); - comprobe_printf ("PROB_file rank:%d fpath:", filerank); - comprobe_outenc_string (dupfilename); - comprobe_puts ("\n"); - comprobe_flush (); - } - else - { - struct filenamehentry_st *oldslot = *slotptr; - filerank = oldslot->rank; - gcc_assert (!strcmp (files_varr.tab[filerank], filename)); - debugeprintf ("old file rank filerank%d file %s oldslot %p", filerank, - filename, (void *) oldslot); - } - return filerank; -} - - -int -comprobe_infopoint_rank (int filerank, int lineno) -{ - int inforank = 0; - struct infopointhentry_st slot; - struct infopointhentry_st **slotptr = 0; - gcc_assert (filerank > 0 && filerank <= files_varr.last); - gcc_assert (lineno > 0); - gcc_assert (infopoint_vector != NULL); - memset (&slot, 0, sizeof (slot)); - slot.infp_filerank = filerank; - slot.infp_lineno = lineno; - slotptr = (struct infopointhentry_st **) - htab_find_slot (infopoint_htable, &slot, INSERT); - if (!slotptr) - fatal_error - ("compiler probe failed to register infopoint filerank=%d,lineno=%d (memory full): %m", - filerank, lineno); - if (*slotptr == HTAB_EMPTY_ENTRY || (*slotptr) == HTAB_DELETED_ENTRY) - { - struct infopointhentry_st *newslot = 0; - newslot = (struct infopointhentry_st *) xcalloc (sizeof (*newslot), 1); - /* dont use index 0 */ - if (VEC_length (infopoint_ptr_t, infopoint_vector) == 0) - VEC_safe_push (infopoint_ptr_t, heap, infopoint_vector, - (struct infopointhentry_st *) 0); - VEC_safe_push (infopoint_ptr_t, heap, infopoint_vector, newslot); - inforank = VEC_length (infopoint_ptr_t, infopoint_vector) - 1; - comprobe_printf ("PROB_infopoint fil:%d lin:%d rk:%d\n", filerank, - lineno, inforank); - comprobe_flush (); - newslot->infp_filerank = filerank; - newslot->infp_lineno = lineno; - newslot->infp_num = inforank; - newslot->infp_dischvec = VEC_alloc (displaychoice_ptr_t, heap, 3); - debugeprintf - ("new infopoint slot filerank%d lineno%d inforank%d slot%p", filerank, - lineno, inforank, (void *) newslot); - *slotptr = newslot; - } - else - { - struct infopointhentry_st *oldslot = (*slotptr); - gcc_assert (oldslot->infp_filerank == filerank - && oldslot->infp_lineno == lineno); - inforank = oldslot->infp_num; - gcc_assert (inforank >= 0 - && inforank < (int) VEC_length (infopoint_ptr_t, - infopoint_vector)); - gcc_assert (VEC_index (infopoint_ptr_t, infopoint_vector, inforank) - == oldslot); - debugeprintf - ("old infopoint slot filerank%d lineno%d inforank%d oldslot%p", - filerank, lineno, inforank, (void *) oldslot); - } - return inforank; -} - - - -/** convenience function for iterating **/ -static bool -get_gimple_position_seq (gimple_seq sq, const char **pfilename, int *plineno, - int end) -{ - gimple_stmt_iterator gsi; - if (!end) - { - for (gsi = gsi_start (sq); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple s = gsi_stmt (gsi); - if (comprobe_get_gimple_position (s, pfilename, plineno, POS_START)) - return true; - } - } - else - { - for (gsi_last (sq); !gsi_end_p (gsi); gsi_prev (&gsi)) - { - gimple s = gsi_stmt (gsi); - if (comprobe_get_gimple_position (s, pfilename, plineno, POS_END)) - return true; - } - } - return false; -} - -/*** - * return true if a gimple G has a position - * and in that case fill the PFILENAME and PLINENO - * if the END flag is set, return the last position - ***/ -bool -comprobe_get_gimple_position (gimple g, const char **pfilename, int *plineno, - int end) -{ - location_t loc = 0; - if (!g) - return false; - loc = gimple_location (g); - if (loc != UNKNOWN_LOCATION && loc != BUILTINS_LOCATION) - { - if (pfilename) - *pfilename = LOCATION_FILE (loc); - if (plineno) - *plineno = LOCATION_LINE (loc); - return true; - } - else if (gimple_has_substatements (g)) - { - switch (gimple_code (g)) - { - case GIMPLE_BIND: - { - gimple_seq sq = gimple_bind_body (g); - return get_gimple_position_seq (sq, pfilename, plineno, end); - } - case GIMPLE_CATCH: - { - gimple_seq sq = gimple_catch_handler (g); - return get_gimple_position_seq (sq, pfilename, plineno, end); - } - case GIMPLE_EH_FILTER: - { - gimple_seq sq = gimple_eh_filter_failure (g); - return get_gimple_position_seq (sq, pfilename, plineno, end); - } - case GIMPLE_TRY: - { - gimple_seq sq; - sq = gimple_try_eval (g); - if (get_gimple_position_seq (sq, pfilename, plineno, end)) - return true; - sq = gimple_try_cleanup (g); - return get_gimple_position_seq (sq, pfilename, plineno, end); - } - case GIMPLE_WITH_CLEANUP_EXPR: - { - gimple_seq sq = gimple_wce_cleanup (g); - return get_gimple_position_seq (sq, pfilename, plineno, end); - } - case GIMPLE_OMP_FOR: - case GIMPLE_OMP_MASTER: - case GIMPLE_OMP_ORDERED: - case GIMPLE_OMP_SECTION: - case GIMPLE_OMP_PARALLEL: - case GIMPLE_OMP_TASK: - case GIMPLE_OMP_SECTIONS: - case GIMPLE_OMP_SINGLE: - { - static bool warned; - if (!warned) - { - warning (0, - "compiler probe not implemented for OpenMP stuff"); - warned = true; - } - return false; - } - break; - default: - gcc_unreachable (); - } - } - return false; -} - -bool -comprobe_get_tree_position (tree t, const char **pfilename, int *plineno, int end ATTRIBUTE_UNUSED) -{ - location_t loc = 0; - if (!t) - return false; - loc = EXPR_LOCATION (t); - if (loc != UNKNOWN_LOCATION && loc != BUILTINS_LOCATION) - { - if (pfilename) - *pfilename = LOCATION_FILE (loc); - if (plineno) - *plineno = LOCATION_LINE (loc); - return true; - } - return false; -} - -int -comprobe_file_rank_of_gimple (gimple g, int *plineno) -{ - const char *filename = 0; - int lineno = 0, filerank = 0; - if (!g) - return 0; - if (!comprobe_get_gimple_position (g, &filename, &lineno, POS_START)) - return 0; - filerank = comprobe_file_rank (filename); - if (filerank > 0 && plineno) - *plineno = lineno; - return filerank; -} - -int -comprobe_file_rank_of_tree (tree tr, int *plineno) -{ - const char *filename = 0; - int lineno = 0, filerank = 0; - if (!tr) - return 0; - if (!comprobe_get_tree_position (tr, &filename, &lineno, POS_START)) - return 0; - filerank = comprobe_file_rank (filename); - if (filerank > 0 && plineno) - *plineno = lineno; - return filerank; -} - - -/* run the compiler probe pass only if we have a real probe */ -static bool -gate_comprobe (void) -{ - return comprobe_replf != (FILE *) 0 && comprobe_pid != (pid_t) 0; -} - - -/* add information point and display start of a given fimple G with - string DMESG - return the infopoint rank */ -static int -added_infopoint_display_gimple (gimple g, const char *dmesg) -{ - int frk = 0, lin = 0, infrk = 0; - comprobe_ix_t trix = 0; - debugeprintf("added_infopoint_display_gimple g %p dmesg %s", (void*)g, dmesg); - if (!g) - return 0; - frk = comprobe_file_rank_of_gimple (g, &lin); - debugeprintf("added_infopoint_display_gimple frk%d lin %d", frk, lin); - if (frk > 0 && lin > 0) - { - trix = comprobe_unique_index_of_gimple (g); - debugeprintf("added_infopoint_display_gimple trix %d", (int)trix); - gcc_assert (trix > 2); - infrk = comprobe_infopoint_rank (frk, lin); - comprobe_infopoint_add_display (infrk, gimple_starting_displayer, dmesg, - (HOST_WIDE_INT) trix); - debugeprintf("added_infopoint_display_gimple infrk %d", (int)infrk); - return infrk; - }; - debugeprintf("added_infopoint_display_gimple gives %d", 0); - return 0; -} - - -static void -add_infopoint_bodyseq (gimple_seq sq) -{ - gimple_stmt_iterator gsi; - int rk = 0; - const char *filename = 0; - int lineno = 0; - int filrk = 0, infrk = 0; - int stix = 0; - debugeprintf ("add_infopoint_bodyseq %p start", (void *) sq); - if (!sq) - return; - if (flag_compiler_probe_debug) - debug_gimple_seq (sq); - for (gsi = gsi_start (sq); !gsi_end_p (gsi); gsi_next (&gsi)) - { - char titbuf[64]; - gimple stmt = gsi_stmt (gsi); - if (!stmt) - continue; - rk++; - debugeprintf ("add_infopoint_bodyseq stmt=%p rk=%d", (void *) stmt, rk); - if (flag_compiler_probe_debug) - debug_gimple_stmt (stmt); - if (comprobe_get_gimple_position (stmt, &filename, &lineno, POS_START)) - { - filrk = comprobe_file_rank (filename); - infrk = comprobe_infopoint_rank (filrk, lineno); - memset (titbuf, 0, sizeof (titbuf)); - snprintf (titbuf, sizeof (titbuf) - 1, "%d-th gimple body stmt", rk); - stix = comprobe_unique_index_of_gimple (stmt); - debugeprintf ("add_infopoint_bodyseq stix=%d", (int)stix); - gcc_assert (stix > 2); - comprobe_infopoint_add_display - (infrk, gimple_starting_displayer, titbuf, (HOST_WIDE_INT) stix); - } - } - debugeprintf ("add_infopoint_bodyseq %p end", (void *) sq); -} - - -comprobe_ix_t -comprobe_unique_index_of_basic_block (basic_block bb) -{ - comprobe_ix_t bbix = 0; - comprobe_ix_t l = 0, nbbb = 0; - void **sp = 0; - if (bb == NULL || !unique_bb_vector) - return 0; - gcc_assert (unique_bb_vector - && VEC_length (basic_block, unique_bb_vector) > 2); - l = (comprobe_ix_t) HTAB_SEEKED_ENTRY; - nbbb = VEC_length (basic_block, unique_bb_vector); - unique_seeked_bb = bb; - sp = htab_find_slot (unique_bb_htable, &l, INSERT); - if (sp) - { - if (*sp != HTAB_EMPTY_ENTRY && *sp != HTAB_DELETED_ENTRY - && *sp != HTAB_SEEKED_ENTRY) - l = *(comprobe_ix_t *) (*sp); - else - l = 0; - if (l > 2) - { - gcc_assert (l < nbbb - && VEC_index (basic_block, unique_bb_vector, l) == bb); - bbix = l; - } - else - { - VEC_safe_push (basic_block, gc, unique_bb_vector, bb); - bbix = nbbb; - *(comprobe_ix_t *) (sp) = bbix; - } - } - else /* failed to insert into unique_bb_htable */ - gcc_unreachable (); - return bbix; -} - - -basic_block -comprobe_basic_block_of_unique_index (comprobe_ix_t ix) -{ - int nbbb = 0; - if (ix < 2 || !unique_bb_vector) - return NULL; - nbbb = VEC_length (basic_block, unique_bb_vector); - if ((long) ix < (long) nbbb) - return VEC_index (basic_block, unique_bb_vector, ix); - return NULL; -} - -/* add information point for a given basic block */ -static void -add_infopoint_basic_block (basic_block bb) -{ - gimple_stmt_iterator gsi; - int stmtcnt = 0; - comprobe_ix_t bbix = 0; - bool bbgotpos = false; - debugeprintf ("add_infopoint_basic_block bb %p #%d start", (void *) bb, - bb ? bb->index : -1); - if (bb == NULL) - return; - if (flag_compiler_probe_debug) - dump_bb (bb, stderr, 0); - bbix = comprobe_unique_index_of_basic_block (bb); - gcc_assert (bbix > 2); - bbgotpos = FALSE; - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - const char *filename = 0; - int lineno = 0; - int filrk = 0, infrk = 0; - static char msgbuf[64]; - debugeprintf ("add_infopoint_basic_block stmt %p stmtcnt %d", - (void *) stmt, stmtcnt); - if (stmt) - { - stmtcnt++; - } - else - continue; - if (flag_compiler_probe_debug) - debug_gimple_stmt (stmt); - if (comprobe_get_gimple_position (stmt, &filename, &lineno, POS_START)) - { - filrk = comprobe_file_rank (filename); - infrk = comprobe_infopoint_rank (filrk, lineno); - if (!bbgotpos) - { - bbgotpos = true; - memset (msgbuf, 0, sizeof (msgbuf)); - snprintf (msgbuf, - sizeof (msgbuf) - 1, "start bb ix%d #%d", (int) bbix, bb->index); - comprobe_infopoint_add_display - (infrk, bb_starting_displayer, msgbuf, (HOST_WIDE_INT) bbix); - }; - memset (msgbuf, 0, sizeof (msgbuf)); - snprintf (msgbuf, - sizeof (msgbuf) - 1, "stmt#%d bbix%d", stmtcnt, (int) bbix); - (void) added_infopoint_display_gimple (stmt, msgbuf); - } - else - debugeprintf ("add_infopoint_basic_block no position for stmt %p", - (void *) stmt); - } - for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - const char *filename = 0; - int lineno = 0; - int filrk = 0, infrk = 0; - static char msgbuf[64]; - if (comprobe_get_gimple_position (stmt, &filename, &lineno, POS_END)) - { - filrk = comprobe_file_rank (filename); - infrk = comprobe_infopoint_rank (filrk, lineno); - memset (msgbuf, 0, sizeof (msgbuf)); - snprintf (msgbuf, sizeof (msgbuf) - 1, "end bb#%d", bb->index); - comprobe_infopoint_add_display - (infrk, bb_ending_displayer, msgbuf, (HOST_WIDE_INT) bbix); - break; - } - }; - debugeprintf ("add_infopoint_basic_block bb %p end", (void *) bb); -} - - -/* this function does the bulk of the work of the pass and returns - additional TODOs to the pass machinery */ -static unsigned int -execute_comprobe (void) -{ - struct cgraph_node *cgr_fun = 0; - basic_block bb = 0; - for (cgr_fun = cgraph_nodes; cgr_fun; cgr_fun = cgr_fun->next) - { - tree tr_decl = 0; - int frk_decl = 0; - int lin_decl = 0; - gimple_seq sq = 0; - if (!comprobe_replf) - break; - debugeprintf ("execute_comprobe cgr_fun=%p", (void *) cgr_fun); - if (flag_compiler_probe_debug) - dump_cgraph_node (stderr, cgr_fun); - tr_decl = cgr_fun->decl; - if (TREE_CODE (tr_decl) != FUNCTION_DECL) - continue; - frk_decl = comprobe_file_rank_of_tree (tr_decl, &lin_decl); - sq = gimple_body (tr_decl); - debugeprintf ("execute_comprobe sq %p", (void *) sq); - if (!sq) - continue; - add_infopoint_bodyseq (sq); - comprobe_flush (); - } - FOR_EACH_BB (bb) - { - if (!comprobe_replf) - break; - debugeprintf ("execute_comprobe bb %p", (void *) bb); - comprobe_check ("comprobe bb loop"); - add_infopoint_basic_block (bb); - comprobe_flush (); - } - comprobe_flush (); - return 0; /* no additional todos */ -} - -struct gimple_opt_pass pass_compiler_probe = { - { - GIMPLE_PASS, /* type */ - "comprobe", /* name */ - gate_comprobe, /* gate */ - execute_comprobe, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_NONE, /* tv_id */ - PROP_cfg, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ - } -}; - -#include "gt-compiler-probe.h" -/* eof compiler-probe.c */ diff --git a/gcc/compiler-probe.h b/gcc/compiler-probe.h deleted file mode 100644 index 61d576be9ce..00000000000 --- a/gcc/compiler-probe.h +++ /dev/null @@ -1,451 +0,0 @@ -/* Compiler probe. - Copyright (C) 2007 Free Software Foundation, Inc. - Contributed by Basile Starynkevitch <basile@starynkevitch.net> - -This file is part of GCC. - -GCC 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. - -GCC 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 GCC; see the file COPYING. If not, write to -the Free Software Foundation, 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ - -#ifndef GCC_COMPILER_PROBE_H -#define GCC_COMPILER_PROBE_H - -#define COMPROBE_PROTOCOL_NUMBER 200701 - -/* the compiler probe */ -#if defined(ENABLE_COMPILER_PROBE) && ENABLE_COMPILER_PROBE -/* <unistd.h> and <fcntl.h> and <string.h> have already been included - and the following includes have been checked by autoconf */ -#include <sys/select.h> -#include <signal.h> - -/* compiler-probe.c uses the comprobe_ prefix */ - -struct comprobe_whatpos_st -{ - const char *wp_what; - const char *wp_file; - int wp_line; -}; - -/* handling routine for a request (from probe to compiler) */ -typedef void comprobe_requestfun_t (struct comprobe_whatpos_st *wp, - char *reqlin, void *data); - -/**** - * the interrupt flag, its handler, and the macro to check it - ****/ -extern volatile sig_atomic_t comprobe_interrupted; - -void comprobe_handle_probe (const char *what, const char *file, int lineno); - -/* this macro should be put at all the points where we want to permit - compiler probe interaction; in the common case where - comprobe_interrupted is cleared, this macro runs quite quickly */ -#define comprobe_check(WHAT) do{ if (comprobe_interrupted) { \ - comprobe_handle_probe((WHAT),__FILE__,__LINE__); }} while(0) - -/*** - * stop the compiler probe (can be called from action handler) - ***/ -void comprobe_stop (void); - -/*** - * forced kill of the compiler probe - ***/ -void comprobe_forced_kill (void); - -/* force probing till an integer variable is cleared or the probe ended */ -void comprobe_while_probe (const char *what, const char *file, int lineno, - int *pvar); -#define comprobe_while(WHAT,PVAR) do{ \ - comprobe_while_probe((WHAT),__FILE__,__LINE__,(PVAR));}while(0) -/*** - * the stream for replying to the probe ; may be NULL so should be tested! - ***/ -extern FILE *comprobe_replf; -#define comprobe_printf(Fmt, ...) do{if(comprobe_replf) { \ - fprintf(comprobe_replf, (Fmt), ##__VA_ARGS__); \ - fflush(comprobe_replf);}}while(0) -#define comprobe_puts(S) do{if(comprobe_replf) { \ - fputs((S), comprobe_replf); \ - fflush(comprobe_replf);}}while(0) -#define comprobe_flush() do{if(comprobe_replf) \ - fflush(comprobe_replf); } while(0) -void comprobe_begin_big (void); -void comprobe_end_big (void); -void comprobe_outenc_string (const char *s); -#define comprobe_begin_big_printf(Fmt, ...) do{if(comprobe_replf) { \ - comprobe_begin_big(); fprintf(comprobe_replf, (Fmt), \ - ##__VA_ARGS__);}}while(0) -/*** - * initialize and finish. called in toplev.c - ****/ -void comprobe_initialize (void); -void comprobe_finish (void); - - -/**** - * send a message to be shown - ****/ -void comprobe_show_message (const char *msg); - - - -/*** - * return a unique positive file rank for a file path; or 0 for NULL name - * may send a PROB_file request to the probe - ***/ -int comprobe_file_rank (const char *filename); - -/*** - * return a unique positive infopoint rank for a file rank and a line - * number; may send a PROB_file request and a PROB_infopoint request - * to the probe - **/ -int comprobe_infopoint_rank (int filrank, int lineno); - -/*** - * return the linenumber, filerank, and filename of a given infopoint - * or O|NULL if invalid infopoint rank - ***/ -int comprobe_line_of_infopoint (int infoptrank); -int comprobe_filerank_of_infopoint (int infoptrank); -const char *comprobe_filename_of_infopoint (int infoptrank); - -/*** - * infopoint displayer routines - ***/ - -/* info displayers are opaque structures managed by the compiler probe */ -struct comprobe_infodisplay_st; - -typedef void comprobe_infodisplay_fun_t - (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, HOST_WIDE_INT navig); - -void comprobe_infopoint_add_display (int infoptrank, - comprobe_infodisplay_fun_t * dispfun, - const char *msg, HOST_WIDE_INT data); - -/* displayer routines can add navigators */ -void comprobe_display_add_navigator (struct comprobe_infodisplay_st *idi, - comprobe_infodisplay_fun_t * navfun, - const char *msg, HOST_WIDE_INT data); - - -/*** - * verb handler registration (the verb and data should be constant or - * global data, or explicitly allocated at registration and freed - * after unregistration). - ***/ -void comprobe_register (const char *verb, comprobe_requestfun_t * handler, - void *data); -/* unregistration is not yet imlemented */ -void comprobe_unregister (const char *verb); - -typedef HOST_WIDE_INT comprobe_ix_t; - -/*************************************************************************** - * additional tree specific routines are declared only if we know - * about trees because this file has been included after tree.h - *******/ -#ifdef TREE_CODE /*TREE_CODE is an important macro from tree.h */ - -/*** - * return true if a (GIMPLE/SSA) tuple G has a position - * and in that case fill the PFILENAME and PLINENO - * if the END flag is set, return the last position - ***/ -enum { POS_START = 0, POS_END }; -bool comprobe_get_gimple_position (gimple g, const char **pfilename, int *plineno, int end); - -/* likewise for trees*/ -bool comprobe_get_tree_position (tree t, const char **pfilename, int *plineno, int end); - -/*** - * return a unique positive file rank for the location of a gimple, if - * any (else 0); may send a PROB_file request to the probe and set the - * *plineno to the line number - **/ -int comprobe_file_rank_of_gimple (gimple g, int *plineno); -/*** - * return a unique positive file rank for the location of a tree, if - * any (else 0); may send a PROB_file request to the probe and set the - * *plineno to the line number - **/ -int comprobe_file_rank_of_tree (tree tr, int *plineno); - - -/**** - * we manage a unique mapping between gimples and indexes thru our - * hash table; to get the index of a tree or gimple and vice versa the - * tree or gimple of an index - ***/ -comprobe_ix_t comprobe_unique_index_of_gimple (gimple g); -comprobe_ix_t comprobe_unique_index_of_tree (tree tr); -gimple comprobe_gimple_of_unique_index (comprobe_ix_t ix); -tree comprobe_tree_of_unique_index (comprobe_ix_t ix); - -#endif /*TREE_CODE */ - - - - -/************************************************************************ - * additional basic block specific routines are declared only if - * we know about basic blocks because "basic-block.h" have been included - ************************************************************************/ -#ifdef BASIC_BLOCK /* an important macro of basic-block */ -/**** - * we manage a unique mapping between basic blocks and indexes thru - * our hash table; to get the index of a basic block and vice versa - * the basic block of an index - ***/ -comprobe_ix_t comprobe_unique_index_of_basic_block (basic_block bb); -basic_block comprobe_basic_block_of_unique_index (comprobe_ix_t ix); -#endif - -#else /* compiler probe disabled */ - -/***************** fake stubs when probe disabled *******************/ -#define comprobe_check(WHAT) do{}while(0) -#define comprobe_while(WHAT,PVAR) do{}while(0) -#define comprobe_stop() do{}while(0) -#define comprobe_forced_kill() do{}while(0) -#define comprobe_flush() do{}while(0) -#define comprobe_replf ((FILE*)0) -#define comprobe_show_message(M) do{if(0) puts(M);}while(0) -#define comprobe_puts(S) do[}while(0) -#define comprobe_printf(Fmt, ...) do{if(0) printf((Fmt),##__VA_ARGS__);}while(0) -#define comprobe_big_printf(Fmt, ...) do{if(0) printf((Fmt),##__VA_ARGS__);}while(0) -#define comprobe_register(Verb,Hdlr,Data) do{}while(0) -#define comprobe_unregister(Verb,Hdlr,Data) do{}while(0) -#define comprobe_begin_big() -#define comprobe_begin_big_printf(Fmt, ...) do{if(0) printf((Fmt),##__VA_ARGS__);}while(0) -#define comprobe_end_big() -#define comprobe_outenc_string(S) do{if (0 && ((S) == (char*)0));}while(0) -#define comprobe_filerank_of_tree(T,P) (0 && (T) == (tree)0 && (P) == (int*)0) -#define comprobe_unique_index_of_tree(T) (0 && (T) == (tree)0) -#define comprobe_tree_of_unique_index(I) NULL_TREE -#define comprobe_filerank(P) (0 && (P) == (const char*)0) -#define comprobe_get_gimple_position(G,PF,PL,E) (FALSE \ - && (G)!=(gimple)0 \ - && (PF)!=(char**0) \ - && (PL) != (int*)0 && (E)) -#define comprobe_infopoint_add_displayer(IRK,DMESG,DROUT,DATA) while(0 && \ - (IRK) != (int)0 && (DMESG) != (char*)0 && \ - (DROUT) != (comprobe_infoptdisplayroutine_t*)0 && (DATA) != (void*)0) {} -#endif /*ENABLE_COMPILER_PROBE */ - -#endif /*GCC_COMPILER_PROBE_H */ -/* Compiler probe. - Copyright (C) 2007 Free Software Foundation, Inc. - Contributed by Basile Starynkevitch <basile@starynkevitch.net> - -This file is part of GCC. - -GCC 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. - -GCC 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 GCC; see the file COPYING. If not, write to -the Free Software Foundation, 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ - -#ifndef GCC_COMPILER_PROBE_H -#define GCC_COMPILER_PROBE_H - -#define COMPROBE_PROTOCOL_NUMBER 200701 - -/* the compiler probe */ -#if defined(ENABLE_COMPILER_PROBE) && ENABLE_COMPILER_PROBE -/* <unistd.h> and <fcntl.h> and <string.h> have already been included - and the following includes have been checked by autoconf */ -#include <sys/select.h> -#include <signal.h> - -/* compiler-probe.c uses the comprobe_ prefix */ - -struct comprobe_whatpos_st -{ - const char *wp_what; - const char *wp_file; - int wp_line; -}; - -/* handling routine for a request (from probe to compiler) */ -typedef void comprobe_requestfun_t (struct comprobe_whatpos_st *wp, - char *reqlin, void *data); - -/**** - * the interrupt flag, its handler, and the macro to check it - ****/ -extern volatile sig_atomic_t comprobe_interrupted; - -void comprobe_handle_probe (const char *what, const char *file, int lineno); - -/* this macro should be put at all the points where we want to permit - compiler probe interaction; in the common case where - comprobe_interrupted is cleared, this macro runs quite quickly */ -#define comprobe_check(WHAT) do{ if (comprobe_interrupted) { \ - comprobe_handle_probe((WHAT),__FILE__,__LINE__); }} while(0) - -/*** - * stop the compiler probe (can be called from action handler) - ***/ -void comprobe_stop (void); - -/*** - * forced kill of the compiler probe - ***/ -void comprobe_forced_kill (void); - -/* force probing till an integer variable is cleared or the probe ended */ -void comprobe_while_probe (const char *what, const char *file, int lineno, - int *pvar); -#define comprobe_while(WHAT,PVAR) do{ \ - comprobe_while_probe((WHAT),__FILE__,__LINE__,(PVAR));}while(0) -/*** - * the stream for replying to the probe ; may be NULL so should be tested! - ***/ -extern FILE *comprobe_replf; -#define comprobe_printf(Fmt, ...) do{if(comprobe_replf) { \ - fprintf(comprobe_replf, (Fmt), ##__VA_ARGS__); \ - fflush(comprobe_replf);}}while(0) -#define comprobe_flush() do{if(comprobe_replf) \ - fflush(comprobe_replf); } while(0) -void comprobe_begin_big (void); -void comprobe_end_big (void); -void comprobe_outenc_string (const char *s); -#define comprobe_begin_big_printf(Fmt, ...) do{if(comprobe_replf) { \ - comprobe_begin_big(); fprintf(comprobe_replf, (Fmt), \ - ##__VA_ARGS__);}}while(0) -/*** - * initialize and finish. called in toplev.c - ****/ -void comprobe_initialize (void); -void comprobe_finish (void); - - -/**** - * send a message to be shown - ****/ -void comprobe_show_message (const char *msg); - - -extern struct tree_opt_pass pass_compiler_probe; - -/*** - * return a unique positive file rank for a file path; or 0 for NULL name - * may send a PROB_file request to the probe - ***/ -int comprobe_file_rank (const char *filename); - -/*** - * return a unique positive infopoint rank for a file rank and a line - * number; may send a PROB_file request and a PROB_infopoint request - * to the probe - **/ -int comprobe_infopoint_rank (int filrank, int lineno); - -/*** - * return the linenumber, filerank, and filename of a given infopoint - * or O|NULL if invalid infopoint rank - ***/ -int comprobe_line_of_infopoint (int infoptrank); -int comprobe_filerank_of_infopoint (int infoptrank); -const char *comprobe_filename_of_infopoint (int infoptrank); - -/*** - * infopoint displayer routines - ***/ - -/* info displayers are opaque structures managed by the compiler probe */ -struct comprobe_infodisplay_st; - -typedef void comprobe_infodisplay_fun_t - (struct comprobe_whatpos_st *wp, - struct comprobe_infodisplay_st *di, - HOST_WIDE_INT data, HOST_WIDE_INT navig); - -void comprobe_infopoint_add_display (int infoptrank, - comprobe_infodisplay_fun_t * dispfun, - const char *msg, HOST_WIDE_INT data); - -/* displayer routines can add navigators */ -void comprobe_display_add_navigator (struct comprobe_infodisplay_st *idi, - comprobe_infodisplay_fun_t * navfun, - const char *msg, HOST_WIDE_INT data); - - -/*** - * verb handler registration (the verb and data should be constant or - * global data, or explicitly allocated at registration and freed - * after unregistration). - ***/ -void comprobe_register (const char *verb, comprobe_requestfun_t * handler, - void *data); -/* unregistration is not yet imlemented */ -void comprobe_unregister (const char *verb); - -typedef HOST_WIDE_INT comprobe_ix_t; - - - -#else /* compiler probe disabled */ - -/***************** fake stubs when probe disabled *******************/ -#define comprobe_check(WHAT) do{}while(0) -#define comprobe_while(WHAT,PVAR) do{}while(0) -#define comprobe_stop() do{}while(0) -#define comprobe_forced_kill() do{}while(0) -#define comprobe_flush() do{}while(0) -#define comprobe_replf ((FILE*)0) -#define comprobe_show_message(M) do{if(0) puts(M);}while(0) -#define comprobe_printf(Fmt, ...) do{if(0) printf((Fmt),##__VA_ARGS__);}while(0) -#define comprobe_big_printf(Fmt, ...) do{if(0) printf((Fmt),##__VA_ARGS__);}while(0) -#define comprobe_register(Verb,Hdlr,Data) do{}while(0) -#define comprobe_unregister(Verb,Hdlr,Data) do{}while(0) -#define comprobe_begin_big() -#define comprobe_begin_big_printf(Fmt, ...) do{if(0) printf((Fmt),##__VA_ARGS__);}while(0) -#define comprobe_end_big() -#define comprobe_outenc_string(S) do{if (0 && ((S) == (char*)0));}while(0) -#define comprobe_filerank_of_tree(T,P) (0 && (T) == (tree)0 && (P) == (int*)0) -#define comprobe_unique_index_of_tree(T) (0 && (T) == (tree)0) -#define comprobe_tree_of_unique_index(I) NULL_TREE -#define comprobe_filerank(P) (0 && (P) == (const char*)0) -#define comprobe_get_tree_position(T,PF,PL,E) (FALSE \ - && (T)!=(tree)0 \ - && (PF)!=(char**0) \ - && (PL) != (int*)0 && (E)) -#define comprobe_get_gimple_position(G,PF,PL,E) (FALSE \ - && (T)!=(gimple)0 \ - && (PF)!=(char**0) \ - && (PL) != (int*)0 && (E)) -#define comprobe_infopoint_add_displayer(IRK,DMESG,DROUT,DATA) while(0 && \ - (IRK) != (int)0 && (DMESG) != (char*)0 && \ - (DROUT) != (comprobe_infoptdisplayroutine_t*)0 && (DATA) != (void*)0) {} -#endif /*ENABLE_COMPILER_PROBE */ - -#endif /*GCC_COMPILER_PROBE_H */ diff --git a/gcc/config.in b/gcc/config.in index 41e772a8907..06aaa55ab2c 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -52,12 +52,6 @@ #endif -/* Define if compiler probe is enabled. */ -#ifndef USED_FOR_TARGET -#undef ENABLE_COMPILER_PROBE -#endif - - /* Define to 1 to specify that we are using the BID decimal floating point format instead of DPD */ #ifndef USED_FOR_TARGET diff --git a/gcc/configure b/gcc/configure index acb10e695b5..d4fb45d892f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -458,7 +458,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP ppllibs pplinc ltdllibs ltdlinc ltdl_ldflags gdbmlibs gdbminc gdbm_ldflags COMPILER_PROBE_OBJECT BASILYSMELT_OBJECT loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file TM_ENDIAN_CONFIG TM_MULTILIB_CONFIG TM_MULTILIB_EXCEPTIONS_CONFIG extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines use_gcc_stdint c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC pluginlibs enable_plugin LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP ppllibs pplinc ltdllibs ltdlinc ltdl_ldflags gdbmlibs gdbminc gdbm_ldflags BASILYSMELT_OBJECT loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file TM_ENDIAN_CONFIG TM_MULTILIB_CONFIG TM_MULTILIB_EXCEPTIONS_CONFIG extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines use_gcc_stdint c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC pluginlibs enable_plugin LIBOBJS LTLIBOBJS' ac_subst_files='language_hooks' ac_pwd=`pwd` @@ -1028,18 +1028,11 @@ Optional Features: put copies of generated files in source dir intended for creating source tarballs for users without texinfo bison or flex. - --enable-compiler-probe Enable instrumenting probe of compiler - only useful for compiler hackers or - users expecting huge compilation times; - this could slow down the compiler - hence is disabled by default. - --enable-basilysmelt Enable Basilys/MELT passes; This enable complex (sciptable) passes using the Middle End Lisp Translator feature (which dynamically translates the MELT lisp dialect into C plug-in like code); This requires PPL (Parma Polyhedra -Library), GDBM and LTDL (LibTool Dynamic Loader) support. The -compiler-probe feature is also recommended. +Library), GDBM and LTDL (LibTool Dynamic Loader) support. --enable-werror-always enable -Werror despite compiler version --enable-checking=LIST enable expensive run-time checks. With LIST, @@ -7514,121 +7507,7 @@ LDFLAGS="$saved_LDFLAGS" # for debugging only echo '%!%' after GDBM LIBS= $LIBS CFLAGS= $CFLAGS -# ------------------------ -# Compiler probing support -# ------------------------ -enabled_compiler_probe=no - -# Check whether --enable-compiler-probe or --disable-compiler-probe was given. -if test "${enable_compiler_probe+set}" = set; then - enableval="$enable_compiler_probe" - enabled_compiler_probe=$enableval -else - enabled_compiler_probe=no -fi; - -if test "$enabled_compiler_probe" = "yes" ; then - echo "$as_me:$LINENO: checking for features required for compiler probe" >&5 -echo $ECHO_N "checking for features required for compiler probe... $ECHO_C" >&6 -## we check specifically for the Posix/SuS (Single Unix Spec) select, -## for the SIGPOLL SuS signal handled by SuS sigaction -## and for fcntl F_SETOWN available in Linux, *BSD, Solaris -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* testing features for compiler probe */ -#include <unistd.h> -#include <fcntl.h> -#include <sys/select.h> -#include <signal.h> -#include <string.h> - -volatile sig_atomic_t my_flag; -static void my_signal_handler(int sig) -{if (sig == SIGPOLL) my_flag=1;} - -int -main () -{ - - fd_set rfs; - int fd = 1; - struct timeval tv; - struct sigaction sa; - FD_ZERO (&rfs); - FD_SET (0, &rfs); - tv.tv_sec = 0; - tv.tv_usec = 500000; - /* Posix/Single Unix Spec select */ - if (select (1, &rfs, (fd_set *) 0, (fd_set *) 0, &tv)) - return 0; - /* Posix/SuS signal */ - memset (&sa, 0, sizeof (sa)); - sa.sa_handler = my_signal_handler; - if (sigaction (SIGPOLL, &sa, (struct sigaction *) 0)) - return 0; - /* Linux, Solaris, and most BSD have F_SETOWN */ - if (fcntl (fd, F_SETOWN, (long) getpid ())) - return 0; - return 0; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; - enabled_compiler_probe=yes; - -cat >>confdefs.h <<\_ACEOF -#define ENABLE_COMPILER_PROBE 1 -_ACEOF - - COMPILER_PROBE_OBJECT=compiler-probe.o - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; - { echo "$as_me:$LINENO: WARNING: Your system lacks the required features for compiler probing. - Hence compiler probe is disabled." >&5 -echo "$as_me: WARNING: Your system lacks the required features for compiler probing. - Hence compiler probe is disabled." >&2;}; - enabled_compiler_probe=no - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext; -fi - - +## Compiler probe support remove in svn rev 148272 # ------------------------ # Basilys/MELT support (middle-end lisp translator) @@ -15036,13 +14915,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:15039: $ac_compile\"" >&5) + (eval echo "\"\$as_me:14918: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:15042: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:14921: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:15045: output\"" >&5) + (eval echo "\"\$as_me:14924: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -16199,7 +16078,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 16202 "configure"' > conftest.$ac_ext + echo '#line 16081 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -17498,11 +17377,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17501: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17380: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17505: \$? = $ac_status" >&5 + echo "$as_me:17384: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17837,11 +17716,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17840: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17719: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17844: \$? = $ac_status" >&5 + echo "$as_me:17723: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17942,11 +17821,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17945: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17824: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17949: \$? = $ac_status" >&5 + echo "$as_me:17828: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17997,11 +17876,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18000: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17879: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:18004: \$? = $ac_status" >&5 + echo "$as_me:17883: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20809,7 +20688,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20812 "configure" +#line 20691 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -20905,7 +20784,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20908 "configure" +#line 20787 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -26451,7 +26330,6 @@ s,@ltdl_ldflags@,$ltdl_ldflags,;t t s,@gdbmlibs@,$gdbmlibs,;t t s,@gdbminc@,$gdbminc,;t t s,@gdbm_ldflags@,$gdbm_ldflags,;t t -s,@COMPILER_PROBE_OBJECT@,$COMPILER_PROBE_OBJECT,;t t s,@BASILYSMELT_OBJECT@,$BASILYSMELT_OBJECT,;t t s,@loose_warn@,$loose_warn,;t t s,@strict_warn@,$strict_warn,;t t diff --git a/gcc/configure.ac b/gcc/configure.ac index b23d45ce5d5..dfbf91ec99a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -516,73 +516,7 @@ AC_SUBST(gdbm_ldflags) # for debugging only echo '%!%' after GDBM LIBS= $LIBS CFLAGS= $CFLAGS -# ------------------------ -# Compiler probing support -# ------------------------ -enabled_compiler_probe=no - -AC_ARG_ENABLE(compiler-probe, -[ --enable-compiler-probe Enable instrumenting probe of compiler - only useful for compiler hackers or - users expecting huge compilation times; - this could slow down the compiler - [hence is disabled by default]. -], -enabled_compiler_probe=$enableval, -enabled_compiler_probe=no) - -if test "$enabled_compiler_probe" = "yes" ; then - AC_MSG_CHECKING([for features required for compiler probe]) -## we check specifically for the Posix/SuS (Single Unix Spec) select, -## for the SIGPOLL SuS signal handled by SuS sigaction -## and for fcntl F_SETOWN available in Linux, *BSD, Solaris -AC_TRY_COMPILE([ -/* testing features for compiler probe */ -#include <unistd.h> -#include <fcntl.h> -#include <sys/select.h> -#include <signal.h> -#include <string.h> - -volatile sig_atomic_t my_flag; -static void my_signal_handler(int sig) -{if (sig == SIGPOLL) my_flag=1;} -], -[ - fd_set rfs; - int fd = 1; - struct timeval tv; - struct sigaction sa; - FD_ZERO (&rfs); - FD_SET (0, &rfs); - tv.tv_sec = 0; - tv.tv_usec = 500000; - /* Posix/Single Unix Spec select */ - if (select (1, &rfs, (fd_set *) 0, (fd_set *) 0, &tv)) - return 0; - /* Posix/SuS signal */ - memset (&sa, 0, sizeof (sa)); - sa.sa_handler = my_signal_handler; - if (sigaction (SIGPOLL, &sa, (struct sigaction *) 0)) - return 0; - /* Linux, Solaris, and most BSD have F_SETOWN */ - if (fcntl (fd, F_SETOWN, (long) getpid ())) - return 0; - return 0; -], -[AC_MSG_RESULT([yes]); - enabled_compiler_probe=yes; - AC_DEFINE(ENABLE_COMPILER_PROBE, 1, [Define if compiler probe is enabled.]) - COMPILER_PROBE_OBJECT=compiler-probe.o -], -[AC_MSG_RESULT([no]); - AC_MSG_WARN([Your system lacks the required features for compiler probing. - Hence compiler probe is disabled.]); - enabled_compiler_probe=no] -); -fi - -AC_SUBST(COMPILER_PROBE_OBJECT) +## Compiler probe support remove in svn rev 148272 # ------------------------ # Basilys/MELT support (middle-end lisp translator) @@ -594,8 +528,7 @@ AC_ARG_ENABLE(basilysmelt, [ --enable-basilysmelt Enable Basilys/MELT passes; This enable complex (sciptable) passes using the Middle End Lisp Translator feature (which dynamically translates the MELT lisp dialect into C plug-in like code); This requires PPL (Parma Polyhedra -Library), GDBM and LTDL (LibTool Dynamic Loader) support. The -compiler-probe feature is also recommended. ], +Library), GDBM and LTDL (LibTool Dynamic Loader) support.], enabled_basilysmelt=$enableval, enabled_basilysmelt=no) if test "$enabled_basilysmelt" = "yes" ; then diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 8c6726b2832..160910c5687 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -42,8 +42,6 @@ along with GCC; see the file COPYING3. If not see #include "opts.h" #include "plugin.h" -#include "compiler-probe.h" - /* we just need to kill the compiler probe on internal|fatal errors */ #define pedantic_warning_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING) #define permissive_error_kind() (flag_permissive ? DK_WARNING : DK_ERROR) @@ -661,8 +659,6 @@ fatal_error (const char *gmsgid, ...) report_diagnostic (&diagnostic); va_end (ap); - comprobe_forced_kill(); - gcc_unreachable (); } @@ -681,8 +677,6 @@ internal_error (const char *gmsgid, ...) report_diagnostic (&diagnostic); va_end (ap); - comprobe_forced_kill(); - gcc_unreachable (); } diff --git a/gcc/toplev.c b/gcc/toplev.c index 0ed801ba93f..ce6f7a95812 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -91,7 +91,6 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "alloc-pool.h" #include "tree-mudflap.h" -#include "compiler-probe.h" #include "tree-pass.h" #include "gimple.h" #include "tree-ssa-alias.h" @@ -2377,11 +2376,6 @@ do_compile (void) if (!no_backend) backend_init (); -#if ENABLE_COMPILER_PROBE - /* just to be sure the probe loads the input file */ - (void) comprobe_file_rank(main_input_filename); -#endif - /* Language-dependent initialization. Returns true on success. */ if (lang_dependent_init (main_input_filename)) @@ -2420,12 +2414,6 @@ toplev_main (int argc, char **argv) init_local_tick (); -#if ENABLE_COMPILER_PROBE - /* Initialize the compiler probe (may install a SIGIO handler and - uses the random seed) */ - comprobe_initialize(); -#endif - #if ENABLE_BASILYSMELT /* initialize basilys if needed */ if (basilys_mode_string && basilys_mode_string[0]) @@ -2436,11 +2424,6 @@ toplev_main (int argc, char **argv) if (!exit_after_options) do_compile (); -#if ENABLE_COMPILER_PROBE - /* Finish the compiler probe (may wait) */ - comprobe_finish(); -#endif - #if ENABLE_BASILYSMELT /* finalize basilys if needed */ diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 247f79c4ad0..e6de3772c3c 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -460,7 +460,7 @@ gimple_phi_arg_edge (gimple gs, size_t i) static inline gimple_seq phi_nodes (const_basic_block bb) { - gcc_assert (comprobe_bb_ok_rtl || !(bb->flags & BB_RTL)); + gcc_assert (!(bb->flags & BB_RTL)); if (!bb->il.gimple) return NULL; return bb->il.gimple->phi_nodes; @@ -473,7 +473,7 @@ set_phi_nodes (basic_block bb, gimple_seq seq) { gimple_stmt_iterator i; - gcc_assert (comprobe_bb_ok_rtl || !(bb->flags & BB_RTL)); + gcc_assert (!(bb->flags & BB_RTL)); bb->il.gimple->phi_nodes = seq; if (seq) for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 63b892ad266..1268e35609f 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -419,33 +419,11 @@ extern struct simple_ipa_opt_pass pass_early_local_passes; extern struct simple_ipa_opt_pass pass_ipa_increase_alignment; extern struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility; - - -/**** Basilys/MELT passes *****/ -#if ENABLE_BASILYSMELT -/* at end of lowering passes */ -extern struct gimple_opt_pass pass_basilys_lowering; -/* at end of early optimisations */ -extern struct gimple_opt_pass pass_basilys_earlyopt; -/* at end of interprocedural optimisations */ -extern struct simple_ipa_opt_pass pass_basilys_ipa; -/* at end of late optimisations */ -extern struct gimple_opt_pass pass_basilys_lateopt; -/* at end of ssa */ -extern struct gimple_opt_pass pass_basilys_latessa; -#endif /*ENABLE_BASILYSMELT*/ - - - extern struct gimple_opt_pass pass_all_optimizations; extern struct gimple_opt_pass pass_cleanup_cfg_post_optimizing; extern struct gimple_opt_pass pass_init_datastructures; extern struct gimple_opt_pass pass_fixup_cfg; -#if ENABLE_COMPILER_PROBE -extern struct gimple_opt_pass pass_compiler_probe; -#endif - extern struct rtl_opt_pass pass_expand; extern struct rtl_opt_pass pass_init_function; extern struct rtl_opt_pass pass_jump; |