OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/locations.h" | 5 #include "vm/locations.h" |
6 | 6 |
7 #include "vm/il_printer.h" | 7 #include "vm/il_printer.h" |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 LocationSummary::ContainsCall contains_call) { | 38 LocationSummary::ContainsCall contains_call) { |
39 LocationSummary* summary = new LocationSummary(input_count, 0, contains_call); | 39 LocationSummary* summary = new LocationSummary(input_count, 0, contains_call); |
40 for (intptr_t i = 0; i < input_count; i++) { | 40 for (intptr_t i = 0; i < input_count; i++) { |
41 summary->set_in(i, Location::RequiresRegister()); | 41 summary->set_in(i, Location::RequiresRegister()); |
42 } | 42 } |
43 summary->set_out(out); | 43 summary->set_out(out); |
44 return summary; | 44 return summary; |
45 } | 45 } |
46 | 46 |
47 | 47 |
| 48 Location Location::RegisterOrConstant(Value* value) { |
| 49 ConstantComp* constant = value->definition()->AsConstant(); |
| 50 return (constant != NULL) |
| 51 ? Location::Constant(constant->value()) |
| 52 : Location::RequiresRegister(); |
| 53 } |
| 54 |
| 55 |
| 56 Location Location::FixedRegisterOrConstant(Value* value, Register reg) { |
| 57 ConstantComp* constant = value->definition()->AsConstant(); |
| 58 return (constant != NULL) |
| 59 ? Location::Constant(constant->value()) |
| 60 : Location::RegisterLocation(reg); |
| 61 } |
| 62 |
| 63 |
48 const char* Location::Name() const { | 64 const char* Location::Name() const { |
49 switch (kind()) { | 65 switch (kind()) { |
50 case kInvalid: return "?"; | 66 case kInvalid: return "?"; |
51 case kRegister: return Assembler::RegisterName(reg()); | 67 case kRegister: return Assembler::RegisterName(reg()); |
52 case kXmmRegister: return Assembler::XmmRegisterName(xmm_reg()); | 68 case kXmmRegister: return Assembler::XmmRegisterName(xmm_reg()); |
53 case kStackSlot: return "S"; | 69 case kStackSlot: return "S"; |
54 case kDoubleStackSlot: return "DS"; | 70 case kDoubleStackSlot: return "DS"; |
55 case kUnallocated: | 71 case kUnallocated: |
56 switch (policy()) { | 72 switch (policy()) { |
57 case kAny: | 73 case kAny: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 131 |
116 if (!out().IsInvalid()) { | 132 if (!out().IsInvalid()) { |
117 f->Print(" => "); | 133 f->Print(" => "); |
118 out().PrintTo(f); | 134 out().PrintTo(f); |
119 } | 135 } |
120 | 136 |
121 if (always_calls()) f->Print(" C"); | 137 if (always_calls()) f->Print(" C"); |
122 } | 138 } |
123 | 139 |
124 } // namespace dart | 140 } // namespace dart |
OLD | NEW |