OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const char* Registers::Name(int reg) { | 59 const char* Registers::Name(int reg) { |
60 const char* result; | 60 const char* result; |
61 if ((0 <= reg) && (reg < kNumRegisters)) { | 61 if ((0 <= reg) && (reg < kNumRegisters)) { |
62 result = names_[reg]; | 62 result = names_[reg]; |
63 } else { | 63 } else { |
64 result = "noreg"; | 64 result = "noreg"; |
65 } | 65 } |
66 return result; | 66 return result; |
67 } | 67 } |
68 | 68 |
| 69 |
69 // Support for VFP registers s0 to s31 (d0 to d15). | 70 // Support for VFP registers s0 to s31 (d0 to d15). |
70 // Note that "sN:sM" is the same as "dN/2" | 71 // Note that "sN:sM" is the same as "dN/2" |
71 // These register names are defined in a way to match the native disassembler | 72 // These register names are defined in a way to match the native disassembler |
72 // formatting. See for example the command "objdump -d <binary file>". | 73 // formatting. See for example the command "objdump -d <binary file>". |
73 const char* VFPRegisters::names_[kNumVFPRegisters] = { | 74 const char* VFPRegisters::names_[kNumVFPRegisters] = { |
74 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", | 75 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", |
75 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", | 76 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", |
76 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", | 77 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", |
77 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", | 78 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", |
78 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", | 79 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", |
79 "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15", | 80 "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15" |
80 }; | 81 }; |
81 | 82 |
| 83 |
82 const char* VFPRegisters::Name(int reg) { | 84 const char* VFPRegisters::Name(int reg) { |
83 const char* result; | 85 ASSERT((0 <= reg) && (reg < kNumVFPRegisters)); |
84 if ((0 <= reg) && (reg < kNumVFPRegisters)) { | 86 return names_[reg]; |
85 result = names_[reg]; | |
86 } else { | |
87 result = "no_vfp_reg"; | |
88 } | |
89 return result; | |
90 } | 87 } |
91 | 88 |
| 89 |
92 int Registers::Number(const char* name) { | 90 int Registers::Number(const char* name) { |
93 // Look through the canonical names. | 91 // Look through the canonical names. |
94 for (int i = 0; i < kNumRegisters; i++) { | 92 for (int i = 0; i < kNumRegisters; i++) { |
95 if (strcmp(names_[i], name) == 0) { | 93 if (strcmp(names_[i], name) == 0) { |
96 return i; | 94 return i; |
97 } | 95 } |
98 } | 96 } |
99 | 97 |
100 // Look through the alias names. | 98 // Look through the alias names. |
101 int i = 0; | 99 int i = 0; |
102 while (aliases_[i].reg != kNoRegister) { | 100 while (aliases_[i].reg != kNoRegister) { |
103 if (strcmp(aliases_[i].name, name) == 0) { | 101 if (strcmp(aliases_[i].name, name) == 0) { |
104 return aliases_[i].reg; | 102 return aliases_[i].reg; |
105 } | 103 } |
106 i++; | 104 i++; |
107 } | 105 } |
108 | 106 |
109 // No register with the reguested name found. | 107 // No register with the reguested name found. |
110 return kNoRegister; | 108 return kNoRegister; |
111 } | 109 } |
112 | 110 |
113 | 111 |
114 } } // namespace assembler::arm | 112 } } // namespace assembler::arm |
OLD | NEW |