blob: 6f92aa819943d3fbc47b1f6ec160853687bf2c5a [file] [log] [blame]
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef VM_FLOW_GRAPH_INLINER_H_
#define VM_FLOW_GRAPH_INLINER_H_
#include "vm/allocation.h"
#include "vm/growable_array.h"
namespace dart {
class Field;
class FlowGraph;
class Function;
class FlowGraphInliner : ValueObject {
public:
FlowGraphInliner(FlowGraph* flow_graph,
GrowableArray<const Function*>* inline_id_to_function)
: flow_graph_(flow_graph), inline_id_to_function_(inline_id_to_function) {
}
// The flow graph is destructively updated upon inlining.
void Inline();
// Compute graph info if it was not already computed or if 'force' is true.
static void CollectGraphInfo(FlowGraph* flow_graph, bool force = false);
static void SetInliningId(const FlowGraph& flow_graph, intptr_t inlining_id);
static bool AlwaysInline(const Function& function);
FlowGraph* flow_graph() const { return flow_graph_; }
intptr_t NextInlineId(const Function& function);
private:
friend class CallSiteInliner;
FlowGraph* flow_graph_;
GrowableArray<const Function*>* inline_id_to_function_;
DISALLOW_COPY_AND_ASSIGN(FlowGraphInliner);
};
} // namespace dart
#endif // VM_FLOW_GRAPH_INLINER_H_