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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const char* VFPRegisters::names_[kNumVFPRegisters] = { | 74 const char* VFPRegisters::names_[kNumVFPRegisters] = { |
75 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", | 75 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", |
76 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", | 76 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", |
77 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", | 77 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", |
78 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", | 78 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", |
79 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", | 79 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", |
80 "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15" | 80 "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15" |
81 }; | 81 }; |
82 | 82 |
83 | 83 |
84 const char* VFPRegisters::Name(int reg) { | 84 const char* VFPRegisters::Name(int reg, bool is_double) { |
85 ASSERT((0 <= reg) && (reg < kNumVFPRegisters)); | 85 ASSERT((0 <= reg) && (reg < kNumVFPRegisters)); |
86 return names_[reg]; | 86 return names_[reg + is_double ? kNumVFPSingleRegisters : 0]; |
| 87 } |
| 88 |
| 89 |
| 90 int VFPRegisters::Number(const char* name, bool* is_double) { |
| 91 for (int i = 0; i < kNumVFPRegisters; i++) { |
| 92 if (strcmp(names_[i], name) == 0) { |
| 93 if (i < kNumVFPSingleRegisters) { |
| 94 *is_double = false; |
| 95 return i; |
| 96 } else { |
| 97 *is_double = true; |
| 98 return i - kNumVFPSingleRegisters; |
| 99 } |
| 100 } |
| 101 } |
| 102 |
| 103 // No register with the requested name found. |
| 104 return kNoRegister; |
87 } | 105 } |
88 | 106 |
89 | 107 |
90 int Registers::Number(const char* name) { | 108 int Registers::Number(const char* name) { |
91 // Look through the canonical names. | 109 // Look through the canonical names. |
92 for (int i = 0; i < kNumRegisters; i++) { | 110 for (int i = 0; i < kNumRegisters; i++) { |
93 if (strcmp(names_[i], name) == 0) { | 111 if (strcmp(names_[i], name) == 0) { |
94 return i; | 112 return i; |
95 } | 113 } |
96 } | 114 } |
97 | 115 |
98 // Look through the alias names. | 116 // Look through the alias names. |
99 int i = 0; | 117 int i = 0; |
100 while (aliases_[i].reg != kNoRegister) { | 118 while (aliases_[i].reg != kNoRegister) { |
101 if (strcmp(aliases_[i].name, name) == 0) { | 119 if (strcmp(aliases_[i].name, name) == 0) { |
102 return aliases_[i].reg; | 120 return aliases_[i].reg; |
103 } | 121 } |
104 i++; | 122 i++; |
105 } | 123 } |
106 | 124 |
107 // No register with the reguested name found. | 125 // No register with the requested name found. |
108 return kNoRegister; | 126 return kNoRegister; |
109 } | 127 } |
110 | 128 |
111 | 129 |
112 } } // namespace assembler::arm | 130 } } // namespace assembler::arm |
OLD | NEW |