Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: src/mips/assembler-mips.cc

Issue 1343533002: MIPS: Make all registers addressable in Operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix remaining compiler cctest failures. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips/assembler-mips-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // generation even when generating snapshots. This won't work for cross 57 // generation even when generating snapshots. This won't work for cross
58 // compilation. 58 // compilation.
59 #if defined(__mips__) && defined(__mips_hard_float) && __mips_hard_float != 0 59 #if defined(__mips__) && defined(__mips_hard_float) && __mips_hard_float != 0
60 answer |= 1u << FPU; 60 answer |= 1u << FPU;
61 #endif 61 #endif
62 62
63 return answer; 63 return answer;
64 } 64 }
65 65
66 66
67 const char* DoubleRegister::AllocationIndexToString(int index) {
68 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters);
69 const char* const names[] = {
70 "f0",
71 "f2",
72 "f4",
73 "f6",
74 "f8",
75 "f10",
76 "f12",
77 "f14",
78 "f16",
79 "f18",
80 "f20",
81 "f22",
82 "f24",
83 "f26"
84 };
85 return names[index];
86 }
87
88
89 void CpuFeatures::ProbeImpl(bool cross_compile) { 67 void CpuFeatures::ProbeImpl(bool cross_compile) {
90 supported_ |= CpuFeaturesImpliedByCompiler(); 68 supported_ |= CpuFeaturesImpliedByCompiler();
91 69
92 // Only use statically determined features for cross compile (snapshot). 70 // Only use statically determined features for cross compile (snapshot).
93 if (cross_compile) return; 71 if (cross_compile) return;
94 72
95 // If the compiler is allowed to use fpu then we can use fpu too in our 73 // If the compiler is allowed to use fpu then we can use fpu too in our
96 // code generation. 74 // code generation.
97 #ifndef __mips__ 75 #ifndef __mips__
98 // For the simulator build, use FPU. 76 // For the simulator build, use FPU.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 offset_ = unit * multiplier + offset_addend; 221 offset_ = unit * multiplier + offset_addend;
244 } 222 }
245 223
246 224
247 // ----------------------------------------------------------------------------- 225 // -----------------------------------------------------------------------------
248 // Specific instructions, constants, and masks. 226 // Specific instructions, constants, and masks.
249 227
250 static const int kNegOffset = 0x00008000; 228 static const int kNegOffset = 0x00008000;
251 // addiu(sp, sp, 4) aka Pop() operation or part of Pop(r) 229 // addiu(sp, sp, 4) aka Pop() operation or part of Pop(r)
252 // operations as post-increment of sp. 230 // operations as post-increment of sp.
253 const Instr kPopInstruction = ADDIU | (kRegister_sp_Code << kRsShift) 231 const Instr kPopInstruction = ADDIU | (Register::kCode_sp << kRsShift) |
254 | (kRegister_sp_Code << kRtShift) 232 (Register::kCode_sp << kRtShift) |
255 | (kPointerSize & kImm16Mask); // NOLINT 233 (kPointerSize & kImm16Mask); // NOLINT
256 // addiu(sp, sp, -4) part of Push(r) operation as pre-decrement of sp. 234 // addiu(sp, sp, -4) part of Push(r) operation as pre-decrement of sp.
257 const Instr kPushInstruction = ADDIU | (kRegister_sp_Code << kRsShift) 235 const Instr kPushInstruction = ADDIU | (Register::kCode_sp << kRsShift) |
258 | (kRegister_sp_Code << kRtShift) 236 (Register::kCode_sp << kRtShift) |
259 | (-kPointerSize & kImm16Mask); // NOLINT 237 (-kPointerSize & kImm16Mask); // NOLINT
260 // sw(r, MemOperand(sp, 0)) 238 // sw(r, MemOperand(sp, 0))
261 const Instr kPushRegPattern = SW | (kRegister_sp_Code << kRsShift) 239 const Instr kPushRegPattern =
262 | (0 & kImm16Mask); // NOLINT 240 SW | (Register::kCode_sp << kRsShift) | (0 & kImm16Mask); // NOLINT
263 // lw(r, MemOperand(sp, 0)) 241 // lw(r, MemOperand(sp, 0))
264 const Instr kPopRegPattern = LW | (kRegister_sp_Code << kRsShift) 242 const Instr kPopRegPattern =
265 | (0 & kImm16Mask); // NOLINT 243 LW | (Register::kCode_sp << kRsShift) | (0 & kImm16Mask); // NOLINT
266 244
267 const Instr kLwRegFpOffsetPattern = LW | (kRegister_fp_Code << kRsShift) 245 const Instr kLwRegFpOffsetPattern =
268 | (0 & kImm16Mask); // NOLINT 246 LW | (Register::kCode_fp << kRsShift) | (0 & kImm16Mask); // NOLINT
269 247
270 const Instr kSwRegFpOffsetPattern = SW | (kRegister_fp_Code << kRsShift) 248 const Instr kSwRegFpOffsetPattern =
271 | (0 & kImm16Mask); // NOLINT 249 SW | (Register::kCode_fp << kRsShift) | (0 & kImm16Mask); // NOLINT
272 250
273 const Instr kLwRegFpNegOffsetPattern = LW | (kRegister_fp_Code << kRsShift) 251 const Instr kLwRegFpNegOffsetPattern = LW | (Register::kCode_fp << kRsShift) |
274 | (kNegOffset & kImm16Mask); // NOLINT 252 (kNegOffset & kImm16Mask); // NOLINT
275 253
276 const Instr kSwRegFpNegOffsetPattern = SW | (kRegister_fp_Code << kRsShift) 254 const Instr kSwRegFpNegOffsetPattern = SW | (Register::kCode_fp << kRsShift) |
277 | (kNegOffset & kImm16Mask); // NOLINT 255 (kNegOffset & kImm16Mask); // NOLINT
278 // A mask for the Rt register for push, pop, lw, sw instructions. 256 // A mask for the Rt register for push, pop, lw, sw instructions.
279 const Instr kRtMask = kRtFieldMask; 257 const Instr kRtMask = kRtFieldMask;
280 const Instr kLwSwInstrTypeMask = 0xffe00000; 258 const Instr kLwSwInstrTypeMask = 0xffe00000;
281 const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask; 259 const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask;
282 const Instr kLwSwOffsetMask = kImm16Mask; 260 const Instr kLwSwOffsetMask = kImm16Mask;
283 261
284 262
285 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) 263 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
286 : AssemblerBase(isolate, buffer, buffer_size), 264 : AssemblerBase(isolate, buffer, buffer_size),
287 recorded_ast_id_(TypeFeedbackId::None()), 265 recorded_ast_id_(TypeFeedbackId::None()),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 305
328 void Assembler::CodeTargetAlign() { 306 void Assembler::CodeTargetAlign() {
329 // No advantage to aligning branch/call targets to more than 307 // No advantage to aligning branch/call targets to more than
330 // single instruction, that I am aware of. 308 // single instruction, that I am aware of.
331 Align(4); 309 Align(4);
332 } 310 }
333 311
334 312
335 Register Assembler::GetRtReg(Instr instr) { 313 Register Assembler::GetRtReg(Instr instr) {
336 Register rt; 314 Register rt;
337 rt.code_ = (instr & kRtFieldMask) >> kRtShift; 315 rt.reg_code = (instr & kRtFieldMask) >> kRtShift;
338 return rt; 316 return rt;
339 } 317 }
340 318
341 319
342 Register Assembler::GetRsReg(Instr instr) { 320 Register Assembler::GetRsReg(Instr instr) {
343 Register rs; 321 Register rs;
344 rs.code_ = (instr & kRsFieldMask) >> kRsShift; 322 rs.reg_code = (instr & kRsFieldMask) >> kRsShift;
345 return rs; 323 return rs;
346 } 324 }
347 325
348 326
349 Register Assembler::GetRdReg(Instr instr) { 327 Register Assembler::GetRdReg(Instr instr) {
350 Register rd; 328 Register rd;
351 rd.code_ = (instr & kRdFieldMask) >> kRdShift; 329 rd.reg_code = (instr & kRdFieldMask) >> kRdShift;
352 return rd; 330 return rd;
353 } 331 }
354 332
355 333
356 uint32_t Assembler::GetRt(Instr instr) { 334 uint32_t Assembler::GetRt(Instr instr) {
357 return (instr & kRtFieldMask) >> kRtShift; 335 return (instr & kRtFieldMask) >> kRtShift;
358 } 336 }
359 337
360 338
361 uint32_t Assembler::GetRtField(Instr instr) { 339 uint32_t Assembler::GetRtField(Instr instr) {
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 } 1913 }
1936 1914
1937 1915
1938 void Assembler::movn(Register rd, Register rs, Register rt) { 1916 void Assembler::movn(Register rd, Register rs, Register rt) {
1939 GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVN); 1917 GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVN);
1940 } 1918 }
1941 1919
1942 1920
1943 void Assembler::movt(Register rd, Register rs, uint16_t cc) { 1921 void Assembler::movt(Register rd, Register rs, uint16_t cc) {
1944 Register rt; 1922 Register rt;
1945 rt.code_ = (cc & 0x0007) << 2 | 1; 1923 rt.reg_code = (cc & 0x0007) << 2 | 1;
1946 GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVCI); 1924 GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVCI);
1947 } 1925 }
1948 1926
1949 1927
1950 void Assembler::movf(Register rd, Register rs, uint16_t cc) { 1928 void Assembler::movf(Register rd, Register rs, uint16_t cc) {
1951 Register rt; 1929 Register rt;
1952 rt.code_ = (cc & 0x0007) << 2 | 0; 1930 rt.reg_code = (cc & 0x0007) << 2 | 0;
1953 GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVCI); 1931 GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVCI);
1954 } 1932 }
1955 1933
1956 1934
1957 void Assembler::seleqz(Register rd, Register rs, Register rt) { 1935 void Assembler::seleqz(Register rd, Register rs, Register rt) {
1958 DCHECK(IsMipsArchVariant(kMips32r6)); 1936 DCHECK(IsMipsArchVariant(kMips32r6));
1959 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SELEQZ_S); 1937 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SELEQZ_S);
1960 } 1938 }
1961 1939
1962 1940
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 2204
2227 void Assembler::movz_d(FPURegister fd, FPURegister fs, Register rt) { 2205 void Assembler::movz_d(FPURegister fd, FPURegister fs, Register rt) {
2228 DCHECK(IsMipsArchVariant(kMips32r2)); 2206 DCHECK(IsMipsArchVariant(kMips32r2));
2229 GenInstrRegister(COP1, D, rt, fs, fd, MOVZ_C); 2207 GenInstrRegister(COP1, D, rt, fs, fd, MOVZ_C);
2230 } 2208 }
2231 2209
2232 2210
2233 void Assembler::movt_s(FPURegister fd, FPURegister fs, uint16_t cc) { 2211 void Assembler::movt_s(FPURegister fd, FPURegister fs, uint16_t cc) {
2234 DCHECK(IsMipsArchVariant(kMips32r2)); 2212 DCHECK(IsMipsArchVariant(kMips32r2));
2235 FPURegister ft; 2213 FPURegister ft;
2236 ft.code_ = (cc & 0x0007) << 2 | 1; 2214 ft.reg_code = (cc & 0x0007) << 2 | 1;
2237 GenInstrRegister(COP1, S, ft, fs, fd, MOVF); 2215 GenInstrRegister(COP1, S, ft, fs, fd, MOVF);
2238 } 2216 }
2239 2217
2240 2218
2241 void Assembler::movt_d(FPURegister fd, FPURegister fs, uint16_t cc) { 2219 void Assembler::movt_d(FPURegister fd, FPURegister fs, uint16_t cc) {
2242 DCHECK(IsMipsArchVariant(kMips32r2)); 2220 DCHECK(IsMipsArchVariant(kMips32r2));
2243 FPURegister ft; 2221 FPURegister ft;
2244 ft.code_ = (cc & 0x0007) << 2 | 1; 2222 ft.reg_code = (cc & 0x0007) << 2 | 1;
2245 GenInstrRegister(COP1, D, ft, fs, fd, MOVF); 2223 GenInstrRegister(COP1, D, ft, fs, fd, MOVF);
2246 } 2224 }
2247 2225
2248 2226
2249 void Assembler::movf_s(FPURegister fd, FPURegister fs, uint16_t cc) { 2227 void Assembler::movf_s(FPURegister fd, FPURegister fs, uint16_t cc) {
2250 DCHECK(IsMipsArchVariant(kMips32r2)); 2228 DCHECK(IsMipsArchVariant(kMips32r2));
2251 FPURegister ft; 2229 FPURegister ft;
2252 ft.code_ = (cc & 0x0007) << 2 | 0; 2230 ft.reg_code = (cc & 0x0007) << 2 | 0;
2253 GenInstrRegister(COP1, S, ft, fs, fd, MOVF); 2231 GenInstrRegister(COP1, S, ft, fs, fd, MOVF);
2254 } 2232 }
2255 2233
2256 2234
2257 void Assembler::movf_d(FPURegister fd, FPURegister fs, uint16_t cc) { 2235 void Assembler::movf_d(FPURegister fd, FPURegister fs, uint16_t cc) {
2258 DCHECK(IsMipsArchVariant(kMips32r2)); 2236 DCHECK(IsMipsArchVariant(kMips32r2));
2259 FPURegister ft; 2237 FPURegister ft;
2260 ft.code_ = (cc & 0x0007) << 2 | 0; 2238 ft.reg_code = (cc & 0x0007) << 2 | 0;
2261 GenInstrRegister(COP1, D, ft, fs, fd, MOVF); 2239 GenInstrRegister(COP1, D, ft, fs, fd, MOVF);
2262 } 2240 }
2263 2241
2264 2242
2265 // Arithmetic. 2243 // Arithmetic.
2266 2244
2267 void Assembler::add_s(FPURegister fd, FPURegister fs, FPURegister ft) { 2245 void Assembler::add_s(FPURegister fd, FPURegister fs, FPURegister ft) {
2268 GenInstrRegister(COP1, S, ft, fs, fd, ADD_S); 2246 GenInstrRegister(COP1, S, ft, fs, fd, ADD_S);
2269 } 2247 }
2270 2248
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 if (patched) { 3074 if (patched) {
3097 CpuFeatures::FlushICache(pc + 2, sizeof(Address)); 3075 CpuFeatures::FlushICache(pc + 2, sizeof(Address));
3098 } 3076 }
3099 } 3077 }
3100 3078
3101 3079
3102 } // namespace internal 3080 } // namespace internal
3103 } // namespace v8 3081 } // namespace v8
3104 3082
3105 #endif // V8_TARGET_ARCH_MIPS 3083 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips/assembler-mips-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698