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 :
16 : #ifndef SYZYGY_OPTIMIZE_TRANSFORMS_SUBGRAPH_TRANSFORM_H_
17 : #define SYZYGY_OPTIMIZE_TRANSFORMS_SUBGRAPH_TRANSFORM_H_
18 :
19 : #include "syzygy/block_graph/basic_block_subgraph.h"
20 : #include "syzygy/block_graph/block_graph.h"
21 : #include "syzygy/block_graph/transform_policy.h"
22 : #include "syzygy/optimize/application_profile.h"
23 :
24 : namespace optimize {
25 : namespace transforms {
26 :
27 : // A SubGraphTransformInterface is a pure virtual base class defining
28 : // the basic-block transform API augmented with profiling information.
29 : class SubGraphTransformInterface {
30 : public:
31 : typedef block_graph::BlockGraph BlockGraph;
32 : typedef block_graph::BasicBlockSubGraph BasicBlockSubGraph;
33 : typedef block_graph::TransformPolicyInterface TransformPolicyInterface;
34 :
35 E : virtual ~SubGraphTransformInterface() { }
36 :
37 : // Applies this transform to the provided block.
38 : //
39 : // @param policy The policy object restricting how the transform is applied.
40 : // @param block_graph the block-graph of which the basic block subgraph
41 : // is a part.
42 : // @param basic_block_subgraph the basic block subgraph to be transformed.
43 : // @param subgraph_profile the profile information of the subgraph.
44 : // @returns true on success, false otherwise.
45 : virtual bool TransformBasicBlockSubGraph(
46 : const TransformPolicyInterface* policy,
47 : BlockGraph* block_graph,
48 : BasicBlockSubGraph* basic_block_subgraph,
49 : ApplicationProfile* profile,
50 : SubGraphProfile* subgraph_profile) = 0;
51 : };
52 :
53 : } // namespace transforms
54 : } // namespace optimize
55 :
56 : #endif // SYZYGY_OPTIMIZE_TRANSFORMS_SUBGRAPH_TRANSFORM_H_
|