1 : // Copyright 2012 Google Inc.
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 : // Declares a block-graph transform that trims unnecessary block data from
16 : // blocks, such that the implicit uninitialized data at the tail of the block
17 : // is maximized.
18 : //
19 : // Post TrimTransform the BlockGraph will satisfy the invariant that the
20 : // data_size of each block is exactly equal to its initialized data length.
21 : // This invariant is expected by OrderedBlockGraph and BlockGraphOrderers.
22 :
23 : #ifndef SYZYGY_BLOCK_GRAPH_TRANSFORMS_TRIM_TRANSFORM_H_
24 : #define SYZYGY_BLOCK_GRAPH_TRANSFORMS_TRIM_TRANSFORM_H_
25 :
26 : #include "syzygy/block_graph/transform.h"
27 : #include "syzygy/block_graph/transforms/iterative_transform.h"
28 : #include "syzygy/block_graph/transforms/named_transform.h"
29 :
30 : namespace block_graph {
31 : namespace transforms {
32 :
33 : class TrimTransform : public IterativeTransformImpl<TrimTransform> {
34 : public:
35 E : TrimTransform() { }
36 E : virtual ~TrimTransform() { }
37 :
38 : private:
39 : friend IterativeTransformImpl<TrimTransform>;
40 : friend NamedBlockGraphTransformImpl<TrimTransform>;
41 :
42 : // For NamedBlockGraphTransformImpl.
43 : static const char kTransformName[];
44 :
45 : // For IterativeTransformImpl.
46 : bool OnBlock(BlockGraph* block_graph, BlockGraph::Block* block);
47 : };
48 :
49 : } // namespace transforms
50 : } // namespace block_graph
51 :
52 : #endif // SYZYGY_BLOCK_GRAPH_TRANSFORMS_TRIM_TRANSFORM_H_
|