blob: f3b09733b940f31d544077151c2a41f37e12555a [file] [log] [blame]
David Srbeckye1402122018-06-13 18:20:45 +01001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "dex_register_location.h"
18
19namespace art {
20
21std::ostream& operator<<(std::ostream& stream, DexRegisterLocation::Kind kind) {
22 return stream << "Kind<" << static_cast<int32_t>(kind) << ">";
23}
24
25std::ostream& operator<<(std::ostream& stream, const DexRegisterLocation& reg) {
26 using Kind = DexRegisterLocation::Kind;
27 switch (reg.GetKind()) {
28 case Kind::kInvalid:
29 return stream << "Invalid";
30 case Kind::kNone:
31 return stream << "None";
32 case Kind::kInStack:
33 return stream << "sp+" << reg.GetValue();
34 case Kind::kInRegister:
35 return stream << "r" << reg.GetValue();
36 case Kind::kInRegisterHigh:
37 return stream << "r" << reg.GetValue() << "/hi";
38 case Kind::kInFpuRegister:
39 return stream << "f" << reg.GetValue();
40 case Kind::kInFpuRegisterHigh:
41 return stream << "f" << reg.GetValue() << "/hi";
42 case Kind::kConstant:
43 return stream << "#" << reg.GetValue();
44 default:
45 return stream << "DexRegisterLocation(" << static_cast<uint32_t>(reg.GetKind())
46 << "," << reg.GetValue() << ")";
47 }
48}
49
50} // namespace art