00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 //-*-c++-*- 00037 /* ==================================================================== 00038 * ==================================================================== 00039 * 00040 * Module: cg_swp_options.h 00041 * 00042 * This file defines the SWP_OPTION data structure. 00043 * The global variable SWP_Default is initialized using 00044 * the SWP_OPTION constructore. The SWP_Default is modified 00045 * by the command line options (see cgdriver.cxx). 00046 * 00047 * PU_Configure() is called once per PU. 00048 * 00049 * ==================================================================== 00050 * ==================================================================== 00051 */ 00052 00053 #ifndef cg_swp_options_INCLUDED 00054 #define cg_swp_options_INCLUDED "cg_swp_options.h" 00055 00056 #include "cg_flags.h" 00057 #include "cg_swp.h" 00058 00059 struct SWP_OPTIONS { 00060 00061 // Options accessible from command line (See cgdriver.cxx) 00062 // 00063 INT32 Sched_Direction; 00064 INT32 Heuristics; 00065 INT32 Opt_Level; 00066 #ifdef TARG_IA64 00067 BOOL Enable_Do_Loop; 00068 #endif 00069 BOOL Enable_While_Loop; 00070 BOOL Enable_Bundling; 00071 BOOL Enable_Post_Incr; 00072 INT32 Min_Unroll_Times; 00073 INT32 Max_Unroll_Times; 00074 INT32 Min_Unroll_Times_Set; 00075 INT32 Max_Unroll_Times_Set; 00076 #ifdef TARG_IA64 00077 INT32 Load_Cache_Miss_Ratio; 00078 INT32 Load_Cache_Miss_Latency; 00079 #endif 00080 INT32 Critical_Threshold; 00081 BOOL Prep_Only; 00082 BOOL Min_Retry; 00083 BOOL Implicit_Prefetch; 00084 BOOL Implicit_Prefetch_Set; 00085 BOOL Predicate_Promotion; 00086 BOOL Enable_BRP; 00087 #ifdef TARG_IA64 00088 INT32 FB_Prob1; // percentage of lower bound of feedback prob 00089 INT32 FB_Prob2; // combined with frequency 00090 INT32 FB_Freq; // lower bound of feedback freqency 00091 #endif 00092 INT32 OPS_Limit; 00093 00094 // Options not accessible from command line 00095 // - some are basically compile-time constants; 00096 // - some are derivatives of the command line options. 00097 // e.g. opt_level controls the Budget and Max_II, II_Incr. 00098 // 00099 INT32 Budget; 00100 INT32 Max_Schedule_Incr; 00101 double Max_II_Alpha; 00102 double Max_II_Beta; 00103 double II_Incr_Alpha; 00104 double II_Incr_Beta; 00105 INT32 Grainy_Resources_Length; 00106 00107 // Debugging options 00108 BOOL Enable_Workaround; 00109 INT32 Starting_II; 00110 00111 // Constructor to setup default values 00112 // 00113 SWP_OPTIONS() 00114 { 00115 // Scheduling Direction 00116 // 0 - bidirection 00117 // 1 - top-down 00118 // 2 - bottom-up 00119 Sched_Direction = 0; 00120 00121 // SWP Heuristics 00122 // 0 - resource-scaled slack 00123 // 1 - lstart 00124 // 2 - (-estart) 00125 Heuristics = 0; 00126 00127 // SWP Opt Level 00128 // 0 - fast (cannot exceed the initial estart/lstart range) 00129 // 1 - slow (can push start/stop to earlier/later cycles) 00130 // 2 - even slower 00131 // 3 - 00132 // 00133 // The amount of trials for each OP is SWP_Budget * Opt_Level 00134 // 00135 Opt_Level = 2; 00136 00137 #ifdef TARG_IA64 00138 // Enable SWP of do-loop 00139 Enable_Do_Loop = TRUE; 00140 #endif 00141 // Enable SWP of while-loop 00142 // - will be disabled in PU_Configure() if the architecture 00143 // does not support while-loop SWP. 00144 // 00145 Enable_While_Loop = TRUE; 00146 00147 // Enable SWP bundling and grouping of operations to minimize the number 00148 // of cycles in a modulo scheduled loop-kernel: 00149 // - has no effect for architectures where bundling is not an issue. 00150 // 00151 Enable_Bundling = TRUE; 00152 00153 // Budget 00154 Budget = 10; 00155 00156 // Maximum changes of START/STOP cycles 00157 Max_Schedule_Incr = 20; 00158 00159 // Max II limit and II increments for failed SWP 00160 Max_II_Alpha = 2; 00161 Max_II_Beta = 2.0; 00162 00163 // control II Incr amount 00164 II_Incr_Alpha = -10; 00165 II_Incr_Beta = 1.1; 00166 00167 // Grainy Resources 00168 // OPs that uses more than 'Grainy_Resources_Length' are considered 00169 // difficult to schedule. Therefore they are given priority to schedule. 00170 Grainy_Resources_Length = 10; 00171 00172 #ifdef TARG_IA64 00173 // Adjust Load_Latency for cache missed load 00174 Load_Cache_Miss_Ratio = 100; 00175 Load_Cache_Miss_Latency = 20; // should be proc dependent! 00176 #endif 00177 // default max unrolling == 8 00178 Min_Unroll_Times = 1; 00179 Max_Unroll_Times = (CG_opt_level > 2) ? 8 : 4; 00180 00181 // enable postincr form 00182 Enable_Post_Incr = TRUE; 00183 00184 // For debugging - hardware/simulator workaround 00185 Enable_Workaround = FALSE; 00186 00187 // For debugging - use Starting_II as the first II for scheduling 00188 Starting_II = 0; 00189 00190 // if a resource is 90% utilized, it is 00191 // considered critical 00192 Critical_Threshold = 90; 00193 00194 // Execute the SWP preparation, but skip the modulo scheduler 00195 Prep_Only = FALSE; 00196 00197 // Minimize retry / backtracking at the slight expense of 00198 // register presure 00199 Min_Retry = TRUE; 00200 00201 // Use implicit prefetch (will be disabled if target doesn't support) 00202 Implicit_Prefetch = TRUE; 00203 00204 // Predicate promotion 00205 Predicate_Promotion = TRUE; 00206 00207 // Generation of branch predict instructions (brp.loop.imp) 00208 Enable_BRP = TRUE; 00209 00210 #ifdef TARG_IA64 00211 // Percentage of lower bound of feedback prob 00212 FB_Prob1 = 10; // prob = 0.1 00213 00214 // Same as FB_Prob1, but used in combination with Freq 00215 FB_Prob2 = 50; // prob = 0.5 00216 00217 // Lower bound of feedback frequency 00218 FB_Freq = 100000; 00219 #endif 00220 // Max number of OPs which should be SWPed 00221 OPS_Limit = SWP_OPS_LIMIT; 00222 } 00223 00224 // PU Configure: 00225 // Modify options based on target and loop information 00226 // 00227 void PU_Configure(); 00228 00229 }; 00230 00231 00232 // SWP_Default is initialized by the default SWP_OPTION constructor 00233 // and then modified by the command line options 00234 // 00235 extern SWP_OPTIONS SWP_Options; 00236 00237 #endif
1.5.6