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

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 1127963004: Subzero ARM: lowerArguments (GPR), basic legalize(), and lowerRet(i32, i64). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fix warnings, etc Created 5 years, 7 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/IceTargetLoweringARM32.cpp ('k') | src/IceUtils.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/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 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 // This file implements the TargetLoweringX8632 class, which 10 // This file implements the TargetLoweringX8632 class, which
(...skipping 4437 matching lines...) Expand 10 before | Expand all | Expand 10 after
4448 // Assert that a physical register is allowed. To date, all calls 4448 // Assert that a physical register is allowed. To date, all calls
4449 // to legalize() allow a physical register. If a physical register 4449 // to legalize() allow a physical register. If a physical register
4450 // needs to be explicitly disallowed, then new code will need to be 4450 // needs to be explicitly disallowed, then new code will need to be
4451 // written to force a spill. 4451 // written to force a spill.
4452 assert(Allowed & Legal_Reg); 4452 assert(Allowed & Legal_Reg);
4453 // If we're asking for a specific physical register, make sure we're 4453 // If we're asking for a specific physical register, make sure we're
4454 // not allowing any other operand kinds. (This could be future 4454 // not allowing any other operand kinds. (This could be future
4455 // work, e.g. allow the shl shift amount to be either an immediate 4455 // work, e.g. allow the shl shift amount to be either an immediate
4456 // or in ecx.) 4456 // or in ecx.)
4457 assert(RegNum == Variable::NoRegister || Allowed == Legal_Reg); 4457 assert(RegNum == Variable::NoRegister || Allowed == Legal_Reg);
4458 if (OperandX8632Mem *Mem = llvm::dyn_cast<OperandX8632Mem>(From)) { 4458 if (auto Mem = llvm::dyn_cast<OperandX8632Mem>(From)) {
4459 // Before doing anything with a Mem operand, we need to ensure 4459 // Before doing anything with a Mem operand, we need to ensure
4460 // that the Base and Index components are in physical registers. 4460 // that the Base and Index components are in physical registers.
4461 Variable *Base = Mem->getBase(); 4461 Variable *Base = Mem->getBase();
4462 Variable *Index = Mem->getIndex(); 4462 Variable *Index = Mem->getIndex();
4463 Variable *RegBase = nullptr; 4463 Variable *RegBase = nullptr;
4464 Variable *RegIndex = nullptr; 4464 Variable *RegIndex = nullptr;
4465 if (Base) { 4465 if (Base) {
4466 RegBase = legalizeToVar(Base); 4466 RegBase = legalizeToVar(Base);
4467 } 4467 }
4468 if (Index) { 4468 if (Index) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4503 // Immediate specifically not allowed 4503 // Immediate specifically not allowed
4504 NeedsReg = true; 4504 NeedsReg = true;
4505 if (!(Allowed & Legal_Mem) && isScalarFloatingType(From->getType())) 4505 if (!(Allowed & Legal_Mem) && isScalarFloatingType(From->getType()))
4506 // On x86, FP constants are lowered to mem operands. 4506 // On x86, FP constants are lowered to mem operands.
4507 NeedsReg = true; 4507 NeedsReg = true;
4508 if (NeedsReg) { 4508 if (NeedsReg) {
4509 From = copyToReg(From, RegNum); 4509 From = copyToReg(From, RegNum);
4510 } 4510 }
4511 return From; 4511 return From;
4512 } 4512 }
4513 if (Variable *Var = llvm::dyn_cast<Variable>(From)) { 4513 if (auto Var = llvm::dyn_cast<Variable>(From)) {
4514 // Check if the variable is guaranteed a physical register. This 4514 // Check if the variable is guaranteed a physical register. This
4515 // can happen either when the variable is pre-colored or when it is 4515 // can happen either when the variable is pre-colored or when it is
4516 // assigned infinite weight. 4516 // assigned infinite weight.
4517 bool MustHaveRegister = (Var->hasReg() || Var->getWeight().isInf()); 4517 bool MustHaveRegister = (Var->hasReg() || Var->getWeight().isInf());
4518 // We need a new physical register for the operand if: 4518 // We need a new physical register for the operand if:
4519 // Mem is not allowed and Var isn't guaranteed a physical 4519 // Mem is not allowed and Var isn't guaranteed a physical
4520 // register, or 4520 // register, or
4521 // RegNum is required and Var->getRegNum() doesn't match. 4521 // RegNum is required and Var->getRegNum() doesn't match.
4522 if ((!(Allowed & Legal_Mem) && !MustHaveRegister) || 4522 if ((!(Allowed & Legal_Mem) && !MustHaveRegister) ||
4523 (RegNum != Variable::NoRegister && RegNum != Var->getRegNum())) { 4523 (RegNum != Variable::NoRegister && RegNum != Var->getRegNum())) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4561 if (RegNum == Variable::NoRegister) 4561 if (RegNum == Variable::NoRegister)
4562 Reg->setWeightInfinite(); 4562 Reg->setWeightInfinite();
4563 else 4563 else
4564 Reg->setRegNum(RegNum); 4564 Reg->setRegNum(RegNum);
4565 return Reg; 4565 return Reg;
4566 } 4566 }
4567 4567
4568 void TargetX8632::postLower() { 4568 void TargetX8632::postLower() {
4569 if (Ctx->getFlags().getOptLevel() == Opt_m1) 4569 if (Ctx->getFlags().getOptLevel() == Opt_m1)
4570 return; 4570 return;
4571 // Find two-address non-SSA instructions where Dest==Src0, and set 4571 inferTwoAddress();
4572 // the DestNonKillable flag to keep liveness analysis consistent.
4573 for (auto Inst = Context.getCur(), E = Context.getNext(); Inst != E; ++Inst) {
4574 if (Inst->isDeleted())
4575 continue;
4576 if (Variable *Dest = Inst->getDest()) {
4577 // TODO(stichnot): We may need to consider all source
4578 // operands, not just the first one, if using 3-address
4579 // instructions.
4580 if (Inst->getSrcSize() > 0 && Inst->getSrc(0) == Dest)
4581 Inst->setDestNonKillable();
4582 }
4583 }
4584 } 4572 }
4585 4573
4586 void TargetX8632::makeRandomRegisterPermutation( 4574 void TargetX8632::makeRandomRegisterPermutation(
4587 llvm::SmallVectorImpl<int32_t> &Permutation, 4575 llvm::SmallVectorImpl<int32_t> &Permutation,
4588 const llvm::SmallBitVector &ExcludeRegisters) const { 4576 const llvm::SmallBitVector &ExcludeRegisters) const {
4589 // TODO(stichnot): Declaring Permutation this way loses type/size 4577 // TODO(stichnot): Declaring Permutation this way loses type/size
4590 // information. Fix this in conjunction with the caller-side TODO. 4578 // information. Fix this in conjunction with the caller-side TODO.
4591 assert(Permutation.size() >= RegX8632::Reg_NUM); 4579 assert(Permutation.size() >= RegX8632::Reg_NUM);
4592 // Expected upper bound on the number of registers in a single 4580 // Expected upper bound on the number of registers in a single
4593 // equivalence class. For x86-32, this would comprise the 8 XMM 4581 // equivalence class. For x86-32, this would comprise the 8 XMM
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
4849 case FT_Asm: 4837 case FT_Asm:
4850 case FT_Iasm: { 4838 case FT_Iasm: {
4851 OstreamLocker L(Ctx); 4839 OstreamLocker L(Ctx);
4852 emitConstantPool<PoolTypeConverter<float>>(Ctx); 4840 emitConstantPool<PoolTypeConverter<float>>(Ctx);
4853 emitConstantPool<PoolTypeConverter<double>>(Ctx); 4841 emitConstantPool<PoolTypeConverter<double>>(Ctx);
4854 } break; 4842 } break;
4855 } 4843 }
4856 } 4844 }
4857 4845
4858 } // end of namespace Ice 4846 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | src/IceUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698