OpenASIP 2.2
Loading...
Searching...
No Matches
SchedulerCmdLineOptions.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2010 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file SchedulerCmdLineOptions.cc
26 *
27 * Implementation of SchedulerCmdLineOptions class.
28 *
29 * @author Ari Mets�halme 2005 (ari.metsahalme-no.spam-tut.fi)
30 * @author Pekka Jääskeläinen 2010
31 * @note rating: red
32 */
33
34#include <iostream>
36#include "tce_config.h"
37
38using std::cout;
39using std::endl;
40
41const std::string SchedulerCmdLineOptions::USAGE =
42 "Usage: schedule [OPTION]... SOURCE\n"
43 "Schedule SOURCE binary with the given options\n"
44 "Example: schedule -a mach.adf hello.tpef";
45
46const std::string SchedulerCmdLineOptions::SWL_TARGET_MACHINE = "adf";
48const std::string SchedulerCmdLineOptions::SWL_OUTPUT_FILE = "output";
49const std::string SchedulerCmdLineOptions::SWS_OUTPUT_FILE = "o";
50const std::string SchedulerCmdLineOptions::SWL_LOOP_FLAG = "loop";
52 "scheduling-window-size";
54 "if-conversion-threshold";
56 "lowmem-mode-threshold";
57const std::string SchedulerCmdLineOptions::SWL_RESTRICTED_AA = "restricted-aa";
58const std::string SchedulerCmdLineOptions::SWL_STACK_AA = "stack-aa";
59const std::string SchedulerCmdLineOptions::SWL_OFFSET_AA = "offset-aa";
60const std::string SchedulerCmdLineOptions::SWL_RENAME_REGISTERS = "rename-registers";
62 "print-resource-constraints";
63
65 "dump-ifconversion-cfgs";
66
67const std::string SchedulerCmdLineOptions::SWL_KILL_DEAD_RESULTS = "kill-dead-results";
68const std::string SchedulerCmdLineOptions::SWL_BYPASS_DISTANCE = "bypass-distance";
69const std::string SchedulerCmdLineOptions::SWL_NO_DRE_BYPASS_DISTANCE = "bypass-distance-nodre";
70const std::string SchedulerCmdLineOptions::SWL_OPERAND_SHARE_DISTANCE = "operand-share-distance";
71const std::string SchedulerCmdLineOptions::SWL_NOALIAS_FUNCTIONS = "noalias-functions";
72
73/**
74 * Constructor.
75 */
77
80 SWL_TARGET_MACHINE, "Target machine (.adf file)",
82
85 SWL_OUTPUT_FILE, "Output file name.",
87
90 SWL_LOOP_FLAG, "Use loop optimizations."));
91
95 "The scheduling window size in TTA instructions."));
96
100 "Use restricted C language keyword in alias analyzis."));
101
102 addOption(
104 SWL_STACK_AA, "Enable stack alias analyzer. On by default."));
105
106
107 addOption(
110 "Rename already allocated registers during scheduler"));
111
112 addOption(
115 "The maximum number of moves in an if-structure to predicate "
116 "when if-converting."));
117
118 addOption(
121 "Move count of procedure which activates low-mem mode"
122 "which saves memory from scheduler but "
123 "disables some optimizations."));
124
125 addOption(
127 SWL_OFFSET_AA, "Enable constant offset alias analyzer. On by default."));
128
129 addOption(
132 "Rename already allocated registers during scheduler. "
133 "On by default."));
134
135 addOption(
138 "Print out the resource constraints that potentially limit the "
139 "basic block's schedule."));
140
141 addOption(
144 "Dumps the control flow graphs before and after if-conversion."));
145
146 addOption(
149 "Kill dead results after bypass. On by default."));
150
151 addOption(
154 "Bypass distance when dead result elimination can be used"));
155
156 addOption(
159 "Bypass distance when dead result elimination cannot be used"));
160
161 addOption(
164 "Operand sharing max distance"));
165
166 addOption(
169 "List of functions which are scheduled with assumptions "
170 "that there are no aliased memory accesses in these function "
171 "This allows much more aggressive instruction scheduling, "
172 "but will cause broken code if the code contains memory "
173 "aliasing. Use with extreme caution!"));
174}
175
176/**
177 * Destructor.
178 */
181
182/**
183 * Print the version of the user interface.
184 */
185void
187 cout << "schedule - OpenASIP TTA Scheduler command line interface "
189}
190
191/**
192 * Returns path to the target .adf file defined with the -a switch.
193 *
194 * @return Target adf file defined in the command line.
195 */
196std::string
200
201/**
202 * Returns true if the target machine file is defined, false otherwise.
203 *
204 * @return True if the target machine file is defined.
205 */
206bool
210
211/**
212 * Returns path to the output file defined with the -o switch.
213 *
214 * @return Output file name defined in the command line.
215 */
216std::string
220
221/**
222 * Returns true if the output file name is defined, false otherwise.
223 *
224 * @return True if the output file name is defined.
225 */
226bool
230
231/**
232 * Return true if the loop opt switch was defined in the command line.
233 *
234 * @return True if the loop opt switch was defined in the command line.
235 */
236bool
240
241bool
245
246bool
249 return true;
250 }
252}
253
254bool
257 return true;
258 }
260}
261
262bool
269
270bool
277
278bool
285
286/**
287 * Returns the maximum number of moves in an if-structure which is still
288 * if-converted.
289 *
290 * By default returns -1 which results in using heuristics to define the
291 * maximum values.
292 */
293int
295 if (!findOption(SWL_IF_CONVERSION_THRESHOLD)->isDefined()) {
296 return -1;
297 } else {
299 }
300}
301
302/**
303 * Returns the maximum number of moves in an if-structure which is still
304 * if-converted.
305 *
306 * By default returns -1 which results in using heuristics to define the
307 * maximum values.
308 */
309int
311 if (!findOption(SWL_LOWMEM_MODE_THRESHOLD)->isDefined()) {
312 return -1;
313 } else {
315 }
316}
317
318
319
320/**
321 * Returns the bypass limit when dead result elimination can be used.
322 *
323 * By default returns -1 which results in using heuristics to define the
324 * maximum values.
325 */
326int
328 if (!findOption(SWL_BYPASS_DISTANCE)->isDefined()) {
329 return -1;
330 } else {
332 }
333}
334
335int
337 if (!findOption(SWL_OPERAND_SHARE_DISTANCE)->isDefined()) {
338 return -1;
339 } else {
341 }
342}
343
344
345/**
346 * Returns the bypass limit when dead result elimination cannot be used.
347 *
348 * By default returns -1 which results in using heuristics to define the
349 * maximum values.
350 */
351int
353 if (!findOption(SWL_NO_DRE_BYPASS_DISTANCE)->isDefined()) {
354 return -1;
355 } else {
357 }
358}
359
360bool
367
368/**
369 * Returns the list of "noalias functions" that are scheduled
370 * with assumption of no aliasing memory accesses.
371 */
374 FunctionNameList* funcs = new FunctionNameList();
376 if (opt == NULL)
377 return funcs;
378 for (int i = 1; i <= opt->listSize(); ++i) {
379 funcs->insert(opt->String(i));
380 }
381 return funcs;
382}
SimpleInterPassDatum< std::set< std::string > > FunctionNameList
This datum is set in case the pass should only process (or ignore) certain functions....
static std::string TCEVersionString()
virtual int integer(int index=0) const
virtual int listSize() const
virtual bool isFlagOn() const
virtual std::string String(int index=0) const
bool optionGiven(std::string key) const
CmdLineOptionParser * findOption(std::string name) const
void addOption(CmdLineOptionParser *opt)
virtual bool isOutputFileDefined() const
virtual bool useRestrictedAliasAnalyzer() const
static const std::string SWL_IF_CONVERSION_THRESHOLD
static const std::string SWL_RESOURCE_CONSTRAINT_PRINTING
static const std::string SWL_BYPASS_DISTANCE
virtual bool isMachineFileDefined() const
static const std::string SWL_OFFSET_AA
static const std::string SWL_NOALIAS_FUNCTIONS
static const std::string SWS_TARGET_MACHINE
static const std::string SWL_SCHEDULING_WINDOW
static const std::string SWL_KILL_DEAD_RESULTS
static const std::string SWL_LOOP_FLAG
virtual int lowMemModeThreshold() const
static const std::string SWS_OUTPUT_FILE
virtual bool killDeadResults() const
static const std::string SWL_NO_DRE_BYPASS_DISTANCE
static const std::string SWL_OUTPUT_FILE
virtual std::string machineFile() const
virtual bool dumpIfConversionCFGs() const
static const std::string SWL_TARGET_MACHINE
virtual int noDreBypassDistance() const
static const std::string SWL_RESTRICTED_AA
static const std::string SWL_RENAME_REGISTERS
static const std::string SWL_DUMP_IFCONVERSION_CFGS
static const std::string SWL_OPERAND_SHARE_DISTANCE
static const std::string USAGE
Description of the command line usage of the Scheduler.
virtual bool renameRegisters() const
virtual int ifConversionThreshold() const
virtual bool isLoopOptDefined() const
static const std::string SWL_LOWMEM_MODE_THRESHOLD
virtual int operandShareDistance() const
virtual std::string outputFile() const
virtual FunctionNameList * noaliasFunctions() const
static const std::string SWL_STACK_AA