1 /*
2 * Copyright (C) 2012 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_mips.h"
18
19 #include <ostream>
20
21 namespace art {
22 namespace mips {
23
24 static const char* kRegisterNames[] = {
25 "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
26 "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
27 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
28 "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra",
29 };
operator <<(std::ostream & os,const Register & rhs)30 std::ostream& operator<<(std::ostream& os, const Register& rhs) {
31 if (rhs >= ZERO && rhs <= RA) {
32 os << kRegisterNames[rhs];
33 } else {
34 os << "Register[" << static_cast<int>(rhs) << "]";
35 }
36 return os;
37 }
38
operator <<(std::ostream & os,const FRegister & rhs)39 std::ostream& operator<<(std::ostream& os, const FRegister& rhs) {
40 if (rhs >= F0 && rhs < kNumberOfFRegisters) {
41 os << "f" << static_cast<int>(rhs);
42 } else {
43 os << "FRegister[" << static_cast<int>(rhs) << "]";
44 }
45 return os;
46 }
47
48 } // namespace mips
49 } // namespace art
50