Andreas Gampe | 57b3429 | 2015-01-14 15:45:59 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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 "registers_mips64.h" |
| 18 | |
| 19 | #include <ostream> |
| 20 | |
| 21 | namespace art { |
| 22 | namespace mips64 { |
| 23 | |
| 24 | static const char* kRegisterNames[] = { |
| 25 | "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", |
| 26 | "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3", |
| 27 | "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", |
| 28 | "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", |
| 29 | }; |
| 30 | |
| 31 | std::ostream& operator<<(std::ostream& os, const GpuRegister& rhs) { |
| 32 | if (rhs >= ZERO && rhs < kNumberOfGpuRegisters) { |
| 33 | os << kRegisterNames[rhs]; |
| 34 | } else { |
| 35 | os << "GpuRegister[" << static_cast<int>(rhs) << "]"; |
| 36 | } |
| 37 | return os; |
| 38 | } |
| 39 | |
| 40 | std::ostream& operator<<(std::ostream& os, const FpuRegister& rhs) { |
| 41 | if (rhs >= F0 && rhs < kNumberOfFpuRegisters) { |
| 42 | os << "f" << static_cast<int>(rhs); |
| 43 | } else { |
| 44 | os << "FpuRegister[" << static_cast<int>(rhs) << "]"; |
| 45 | } |
| 46 | return os; |
| 47 | } |
| 48 | |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 49 | std::ostream& operator<<(std::ostream& os, const VectorRegister& rhs) { |
| 50 | if (rhs >= W0 && rhs < kNumberOfVectorRegisters) { |
| 51 | os << "w" << static_cast<int>(rhs); |
| 52 | } else { |
| 53 | os << "VectorRegister[" << static_cast<int>(rhs) << "]"; |
| 54 | } |
| 55 | return os; |
| 56 | } |
| 57 | |
Andreas Gampe | 57b3429 | 2015-01-14 15:45:59 -0800 | [diff] [blame] | 58 | } // namespace mips64 |
| 59 | } // namespace art |