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

Side by Side Diff: src/IceTargetLoweringX8664.cpp

Issue 1676123002: Subzero: Use a proper RegNumT type instead of int32_t/SizeT. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Make it possible to do "auto NewReg = RegNumT::NoRegister;" Created 4 years, 10 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/IceTargetLoweringX8632Traits.h ('k') | src/IceTargetLoweringX8664Traits.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 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 305 }
306 306
307 if (Var->isRematerializable()) { 307 if (Var->isRematerializable()) {
308 return true; 308 return true;
309 } 309 }
310 310
311 if (!Var->hasReg()) { 311 if (!Var->hasReg()) {
312 return false; 312 return false;
313 } 313 }
314 314
315 const int32_t RegNum = Var->getRegNum(); 315 const auto RegNum = Var->getRegNum();
316 if ((RegNum == Traits::RegisterSet::Reg_rsp) || 316 if ((RegNum == Traits::RegisterSet::Reg_rsp) ||
317 (RegNum == Traits::RegisterSet::Reg_rbp)) { 317 (RegNum == Traits::RegisterSet::Reg_rbp)) {
318 return true; 318 return true;
319 } 319 }
320 320
321 return false; 321 return false;
322 } 322 }
323 } // end of anonymous namespace 323 } // end of anonymous namespace
324 324
325 Traits::X86OperandMem *TargetX8664::_sandbox_mem_reference(X86OperandMem *Mem) { 325 Traits::X86OperandMem *TargetX8664::_sandbox_mem_reference(X86OperandMem *Mem) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 if (Offset != nullptr) { 412 if (Offset != nullptr) {
413 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) { 413 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) {
414 NeedsLea = CR->getName() != "" || CR->getOffset() < 0; 414 NeedsLea = CR->getName() != "" || CR->getOffset() < 0;
415 } else if (const auto *Imm = llvm::dyn_cast<ConstantInteger32>(Offset)) { 415 } else if (const auto *Imm = llvm::dyn_cast<ConstantInteger32>(Offset)) {
416 NeedsLea = Imm->getValue() < 0; 416 NeedsLea = Imm->getValue() < 0;
417 } else { 417 } else {
418 llvm::report_fatal_error("Unexpected Offset type."); 418 llvm::report_fatal_error("Unexpected Offset type.");
419 } 419 }
420 } 420 }
421 421
422 int32_t RegNum = Variable::NoRegister; 422 auto RegNum = RegNumT::NoRegister;
423 int32_t RegNum32 = Variable::NoRegister; 423 auto RegNum32 = RegNumT::NoRegister;
424 if (T != nullptr) { 424 if (T != nullptr) {
425 if (T->hasReg()) { 425 if (T->hasReg()) {
426 RegNum = Traits::getGprForType(IceType_i64, T->getRegNum()); 426 RegNum = Traits::getGprForType(IceType_i64, T->getRegNum());
427 RegNum32 = Traits::getGprForType(IceType_i32, RegNum); 427 RegNum32 = Traits::getGprForType(IceType_i32, RegNum);
428 // At this point, if T was assigned to rsp/rbp, then we would have already 428 // At this point, if T was assigned to rsp/rbp, then we would have already
429 // made this the ZeroReg. 429 // made this the ZeroReg.
430 assert(RegNum != Traits::RegisterSet::Reg_rsp); 430 assert(RegNum != Traits::RegisterSet::Reg_rsp);
431 assert(RegNum != Traits::RegisterSet::Reg_rbp); 431 assert(RegNum != Traits::RegisterSet::Reg_rbp);
432 } 432 }
433 433
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \ 806 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \
807 static_assert(_table1_##tag == _table2_##tag, \ 807 static_assert(_table1_##tag == _table2_##tag, \
808 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); 808 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE");
809 ICETYPE_TABLE 809 ICETYPE_TABLE
810 #undef X 810 #undef X
811 } // end of namespace dummy3 811 } // end of namespace dummy3
812 } // end of anonymous namespace 812 } // end of anonymous namespace
813 813
814 } // end of namespace X8664 814 } // end of namespace X8664
815 } // end of namespace Ice 815 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632Traits.h ('k') | src/IceTargetLoweringX8664Traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698