Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
wn_instrument.h
Go to the documentation of this file.
00001 //-*-c++-*-
00002 // ====================================================================
00003 // ====================================================================
00004 //
00005 //
00006 // ====================================================================
00007 //
00008 // Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00009 //
00010 // This program is free software; you can redistribute it and/or modify
00011 // it under the terms of version 2 of the GNU General Public License as
00012 // published by the Free Software Foundation.
00013 //
00014 // This program is distributed in the hope that it would be useful, but
00015 // WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017 //
00018 // Further, this software is distributed without any warranty that it
00019 // is free of the rightful claim of any third person regarding
00020 // infringement  or the like.  Any license provided herein, whether
00021 // implied or otherwise, applies only to this software file.  Patent
00022 // licenses, if any, provided herein do not apply to combinations of
00023 // this program with other software, or any other product whatsoever.
00024 //
00025 // You should have received a copy of the GNU General Public License
00026 // along with this program; if not, write the Free Software Foundation,
00027 // Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
00028 //
00029 // Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00030 // Mountain View, CA 94043, or:
00031 //
00032 // http://www.sgi.com
00033 //
00034 // For further information regarding this notice, see:
00035 //
00036 // http://oss.sgi.com/projects/GenInfo/NoticeExplan
00037 //
00038 // ====================================================================
00039 //
00040 // Description:
00041 //
00042 // The procedures WN_Instrument and WN_Annotate, defined in
00043 // wn_instrument.cxx, invoke the instrumentation and annotation phases
00044 // of feedback collection.
00045 //
00046 // Interface:
00047 //
00048 //   void WN_Instrument( WN *wn, PROFILE_PHASE phase );
00049 //
00050 //     WN_Instrument performs feedback instrumentation on the WHIRL
00051 //     tree rooted at wn (which must be a FUNC_ENTRY node).  This
00052 //     involves inserting into the WHIRL tree invocations to
00053 //     libinstr.so procedures that will collect flow edge frequency
00054 //     counts and store them into a feedback data file when then
00055 //     instrumented program is run.  The PROFILE_PHASE phase is the
00056 //     current point of compilation.
00057 //
00058 //   void WN_Annotate( WN *wn, PROFILE_PHASE phase,
00059 //                     MEM_POOL *MEM_pu_pool );
00060 //
00061 //     WN_Annotate reads frequency counts from one or more previously
00062 //     generated feedback data files and stores the feedback data into
00063 //     the FEEDBACK object Cur_PU_Feedback.  If Cur_PU_Feedback is
00064 //     currently NULL, then a new FEEDBACK object is allocated from
00065 //     the MEM_POOL *MEM_pu_pool.  The PROFILE_PHASE phase is the
00066 //     current point of compilation.  Any FEEDBACK data previously read
00067 //     during an earlier PROFILE_PHASE will be overwritten by the new
00068 //     data.
00069 //
00070 //   void Set_Instrumentation_File_Name( char *fname );
00071 //
00072 //     Set_Instrumentation_File_Name records the prefix for the names
00073 //     of the files from/into which feedback data frequencies are to be
00074 //     read/stored.  The filename prefix is fname concatenated to the
00075 //     PROFILE_PHASE number.
00076 //
00077 // PROFILE_PHASE values are listed in common/com/profile_com.h
00078 //
00079 // Other Important Instrumentation Files:
00080 //
00081 //   common/com/profile_com.h
00082 //   common/com/instr_reader.h
00083 //   common/instrument/instr_reader.cxx
00084 //
00085 // Invokes instrumentation:
00086 //   be/be/driver.cxx (through WN_Instrument and wiw_wopt.Tree_Walk)
00087 //
00088 // ====================================================================
00089 // ====================================================================
00090 
00091 
00092 #ifndef wn_instrument_INCLUDED
00093 #define wn_instrument_INCLUDED
00094 
00095 #include "wn.h"
00096 #include "profile_com.h"            // for PROFILE_PHASE
00097 
00098 
00099 // ====================================================================
00100 //
00101 // Export the following procedures (defined in wn_instrument.cxx)
00102 // 
00103 // ====================================================================
00104 
00105 
00106 extern void WN_Instrument( WN *wn, PROFILE_PHASE phase );
00107 
00108 extern void WN_Annotate(   WN *wn, PROFILE_PHASE phase,
00109                            MEM_POOL *MEM_pu_pool );
00110 
00111 extern void Set_Instrumentation_File_Name( char *fname );
00112 
00113 
00114 // ====================================================================
00115 //
00116 // Profile function names
00117 //
00118 // These macros are the names of the libinstr.so procedures that are
00119 // invoked by the calls inserted into an instrumented WHIRL tree.
00120 //
00121 // ====================================================================
00122 
00123 
00124 #define INST_INIT_NAME            "__profile_init"
00125 #define PU_INIT_NAME              "__profile_pu_init"
00126 
00127 #define INVOKE_INIT_NAME          "__profile_invoke_init"
00128 #define INVOKE_INSTRUMENT_NAME    "__profile_invoke"
00129 #define BRANCH_INIT_NAME          "__profile_branch_init"
00130 #define BRANCH_INSTRUMENT_NAME    "__profile_branch"
00131 #define LOOP_INIT_NAME            "__profile_loop_init"
00132 #define LOOP_INSTRUMENT_NAME      "__profile_loop"
00133 #define LOOP_INST_ITER_NAME       "__profile_loop_iter"
00134 #define SHORT_CIRCUIT_INIT_NAME   "__profile_short_circuit_init"
00135 #define SHORT_CIRCUIT_INST_NAME   "__profile_short_circuit"
00136 #define CALL_INIT_NAME            "__profile_call_init"
00137 #define CALL_INST_ENTRY_NAME      "__profile_call_entry"
00138 #define CALL_INST_EXIT_NAME       "__profile_call_exit"
00139 #define SWITCH_INIT_NAME          "__profile_switch_init"
00140 #define SWITCH_INSTRUMENT_NAME    "__profile_switch"
00141 #define COMPGOTO_INIT_NAME        "__profile_compgoto_init"
00142 #define COMPGOTO_INSTRUMENT_NAME  "__profile_compgoto"
00143 
00144 
00145 // ====================================================================
00146 
00147 #endif
00148 
00149 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines