0b4dfc2312
This CL primarily makes the loop peeling algorithm more robust; it no longer damages the graph if the loops are improperly closed. R=bmeurer@chromium.org BUG= Review URL: https://codereview.chromium.org/1052753004 Cr-Commit-Position: refs/heads/master@{#27620}
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef V8_COMPILER_LOOP_PEELING_H_
|
|
#define V8_COMPILER_LOOP_PEELING_H_
|
|
|
|
#include "src/compiler/loop-analysis.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
namespace compiler {
|
|
|
|
// Represents the output of peeling a loop, which is basically the mapping
|
|
// from the body of the loop to the corresponding nodes in the peeled
|
|
// iteration.
|
|
class PeeledIteration : public ZoneObject {
|
|
public:
|
|
// Maps {node} to its corresponding copy in the peeled iteration, if
|
|
// the node was part of the body of the loop. Returns {node} otherwise.
|
|
Node* map(Node* node);
|
|
|
|
protected:
|
|
PeeledIteration() {}
|
|
};
|
|
|
|
class CommonOperatorBuilder;
|
|
|
|
// Implements loop peeling.
|
|
class LoopPeeler {
|
|
public:
|
|
static bool CanPeel(LoopTree* loop_tree, LoopTree::Loop* loop);
|
|
static PeeledIteration* Peel(Graph* graph, CommonOperatorBuilder* common,
|
|
LoopTree* loop_tree, LoopTree::Loop* loop,
|
|
Zone* tmp_zone);
|
|
};
|
|
|
|
|
|
} // namespace compiler
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // V8_COMPILER_LOOP_PEELING_H_
|