1bd5a9b414
BUG= TEST= Review URL: https://chromiumcodereview.appspot.com//10696151 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9563 260f80e4-7a28-3924-810f-c04153c831b5
75 lines
1.8 KiB
C++
75 lines
1.8 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.
|
|
|
|
#include "vm/locations.h"
|
|
|
|
#include "vm/il_printer.h"
|
|
#include "vm/intermediate_language.h"
|
|
#include "vm/flow_graph_compiler.h"
|
|
|
|
namespace dart {
|
|
|
|
LocationSummary* LocationSummary::Make(intptr_t input_count,
|
|
Location out,
|
|
ContainsCall contains_call) {
|
|
LocationSummary* summary = new LocationSummary(input_count,
|
|
0,
|
|
contains_call);
|
|
for (intptr_t i = 0; i < input_count; i++) {
|
|
summary->set_in(i, Location::RequiresRegister());
|
|
}
|
|
summary->set_out(out);
|
|
return summary;
|
|
}
|
|
|
|
|
|
const char* Location::Name() const {
|
|
switch (kind()) {
|
|
case kInvalid: return "?";
|
|
case kRegister: return Assembler::RegisterName(reg());
|
|
case kUnallocated:
|
|
switch (policy()) {
|
|
case kRequiresRegister:
|
|
return "R";
|
|
case kSameAsFirstInput:
|
|
return "0";
|
|
}
|
|
default:
|
|
ASSERT(IsConstant());
|
|
return "C";
|
|
}
|
|
return "?";
|
|
}
|
|
|
|
|
|
void LocationSummary::PrintTo(BufferFormatter* f) const {
|
|
if (input_count() > 0) {
|
|
f->Print(" (");
|
|
for (intptr_t i = 0; i < input_count(); i++) {
|
|
if (i != 0) f->Print(", ");
|
|
f->Print("%s", in(i).Name());
|
|
}
|
|
f->Print(")");
|
|
}
|
|
|
|
if (temp_count() > 0) {
|
|
f->Print(" [");
|
|
for (intptr_t i = 0; i < temp_count(); i++) {
|
|
if (i != 0) f->Print(", ");
|
|
f->Print("%s", temp(i).Name());
|
|
}
|
|
f->Print("]");
|
|
}
|
|
|
|
if (!out().IsInvalid()) {
|
|
f->Print(" => ");
|
|
f->Print("%s", out().Name());
|
|
}
|
|
|
|
if (is_call()) f->Print(" C");
|
|
}
|
|
|
|
} // namespace dart
|
|
|