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 // Support for VFP registers s0 to s31 (d0 to d15). |
| 70 // 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 // formatting. See for example the command "objdump -d <binary file>". |
| 73 const char* VFPRegisters::names_[kNumVFPRegisters] = { |
| 74 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", |
| 75 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", |
| 76 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", |
| 77 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", |
| 78 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", |
| 79 "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15", |
| 80 }; |
| 81 |
| 82 const char* VFPRegisters::Name(int reg) { |
| 83 const char* result; |
| 84 if ((0 <= reg) && (reg < kNumVFPRegisters)) { |
| 85 result = names_[reg]; |
| 86 } else { |
| 87 result = "no_vfp_reg"; |
| 88 } |
| 89 return result; |
| 90 } |
69 | 91 |
70 int Registers::Number(const char* name) { | 92 int Registers::Number(const char* name) { |
71 // Look through the canonical names. | 93 // Look through the canonical names. |
72 for (int i = 0; i < kNumRegisters; i++) { | 94 for (int i = 0; i < kNumRegisters; i++) { |
73 if (strcmp(names_[i], name) == 0) { | 95 if (strcmp(names_[i], name) == 0) { |
74 return i; | 96 return i; |
75 } | 97 } |
76 } | 98 } |
77 | 99 |
78 // Look through the alias names. | 100 // Look through the alias names. |
79 int i = 0; | 101 int i = 0; |
80 while (aliases_[i].reg != kNoRegister) { | 102 while (aliases_[i].reg != kNoRegister) { |
81 if (strcmp(aliases_[i].name, name) == 0) { | 103 if (strcmp(aliases_[i].name, name) == 0) { |
82 return aliases_[i].reg; | 104 return aliases_[i].reg; |
83 } | 105 } |
84 i++; | 106 i++; |
85 } | 107 } |
86 | 108 |
87 // No register with the reguested name found. | 109 // No register with the reguested name found. |
88 return kNoRegister; | 110 return kNoRegister; |
89 } | 111 } |
90 | 112 |
91 | 113 |
92 } } // namespace assembler::arm | 114 } } // namespace assembler::arm |
OLD | NEW |