Files
sdk/runtime/vm/compiler/backend/il_printer.h
T
Martin Kustermann 06f9a9e354 [VM] Introduce function and osr entrypoints to the VM's IR
Similar to how we treat catch entry instructions, this cl adds new
function and osr entry instructions. The [FunctionEntry] and
[OsrEntry] - just like [CatchBlockEntry] - have now their own initial
definitions. The [GraphEntry] has only initial definitions for
constants.

Explicit phis are inserted for all parameter / special parameter
instructions if necessary.

Future work is:

  a) Minimize parallel moves due to the phis on parameters
  b) Cleanup frame setup: Move it entirely into FunctionEntry/CatchEntry
    (instead of the split version we have now)

Fixes https://github.com/dart-lang/sdk/issues/34435
Fixes https://github.com/dart-lang/sdk/issues/34287

Change-Id: Iefa0280a709716f748d6fb0523b8d0f4d8de1fec
Reviewed-on: https://dart-review.googlesource.com/c/74782
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-15 13:02:51 +00:00

68 lines
2.5 KiB
C++

// 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 RUNTIME_VM_COMPILER_BACKEND_IL_PRINTER_H_
#define RUNTIME_VM_COMPILER_BACKEND_IL_PRINTER_H_
#include "platform/text_buffer.h"
#include "vm/compiler/backend/flow_graph.h"
#include "vm/compiler/backend/il.h"
namespace dart {
class ParsedFunction;
const char* RepresentationToCString(Representation rep);
// Graph printing.
class FlowGraphPrinter : public ValueObject {
public:
static const intptr_t kPrintAll = -1;
explicit FlowGraphPrinter(const FlowGraph& flow_graph,
bool print_locations = false)
: function_(flow_graph.function()),
block_order_(flow_graph.reverse_postorder()),
print_locations_(print_locations) {}
// Print the instructions in a block terminated by newlines. Add "goto N"
// to the end of the block if it ends with an unconditional jump to
// another block and that block is not next in reverse postorder.
void PrintBlocks();
void PrintInstruction(Instruction* instr);
static void PrintOneInstruction(Instruction* instr, bool print_locations);
static void PrintTypeCheck(const ParsedFunction& parsed_function,
TokenPosition token_pos,
Value* value,
const AbstractType& dst_type,
const String& dst_name,
bool eliminated);
static void PrintBlock(BlockEntryInstr* block, bool print_locations);
static void PrintGraph(const char* phase, FlowGraph* flow_graph);
// Debugging helper function. If 'num_checks_to_print' is not specified
// all checks will be printed.
static void PrintICData(const ICData& ic_data,
intptr_t num_checks_to_print = kPrintAll);
// Debugging helper function. If 'num_checks_to_print' is not specified
// all checks will be printed.
static void PrintCidRangeData(const CallTargets& ic_data,
intptr_t num_checks_to_print = kPrintAll);
static bool ShouldPrint(const Function& function);
static bool PassesFilter(const char* filter, const Function& function);
private:
const Function& function_;
const GrowableArray<BlockEntryInstr*>& block_order_;
const bool print_locations_;
};
} // namespace dart
#endif // RUNTIME_VM_COMPILER_BACKEND_IL_PRINTER_H_