1 : // Copyright 2013 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Defines the OptimizeApp class, which implements the command-line optimize.exe
16 : // tool.
17 :
18 : #ifndef SYZYGY_OPTIMIZE_OPTIMIZE_APP_H_
19 : #define SYZYGY_OPTIMIZE_OPTIMIZE_APP_H_
20 :
21 : #include "base/command_line.h"
22 : #include "base/files/file_path.h"
23 : #include "base/strings/string_piece.h"
24 : #include "base/time/time.h"
25 : #include "syzygy/application/application.h"
26 :
27 : namespace optimize {
28 :
29 : // This class implements the command-line optimize utility.
30 : class OptimizeApp : public application::AppImplBase {
31 : public:
32 : OptimizeApp()
33 : : AppImplBase("Optimize"),
34 : basic_block_reorder_(false),
35 : block_alignment_(false),
36 : fuzz_(false),
37 : inlining_(false),
38 : allow_inline_assembly_(false),
39 : overwrite_(false),
40 : peephole_(false),
41 E : unreachable_block_(false) {
42 E : }
43 :
44 : // @name Implementation of the AppImplBase interface.
45 : // @{
46 : bool ParseCommandLine(const base::CommandLine* command_line);
47 : bool SetUp();
48 : int Run();
49 : // @}
50 :
51 : protected:
52 : // @name Utility members.
53 : // @{
54 : bool Usage(const base::CommandLine* command_line,
55 : const base::StringPiece& message) const;
56 : // @}
57 :
58 : // @name Command-line parameters.
59 : // @{
60 : base::FilePath input_image_path_;
61 : base::FilePath input_pdb_path_;
62 : base::FilePath output_image_path_;
63 : base::FilePath output_pdb_path_;
64 : base::FilePath branch_file_path_;
65 : base::FilePath unreachable_graph_path_;
66 : bool block_alignment_;
67 : bool basic_block_reorder_;
68 : bool fuzz_;
69 : bool inlining_;
70 : bool allow_inline_assembly_;
71 : bool peephole_;
72 : bool unreachable_block_;
73 : bool overwrite_;
74 : // @}
75 :
76 : private:
77 : DISALLOW_COPY_AND_ASSIGN(OptimizeApp);
78 : };
79 :
80 : } // namespace optimize
81 :
82 : #endif // SYZYGY_OPTIMIZE_OPTIMIZE_APP_H_
|