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

Side by Side Diff: src/IceTargetLoweringARM32.cpp

Issue 1691193002: Subzero: Prototype to make use of RegNumT::No Register more concise (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: changes suggested by stichnot 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/IceTargetLoweringARM32.h ('k') | src/IceTargetLoweringMIPS32.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/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 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 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 return; 1176 return;
1177 } 1177 }
1178 if (Var->mustHaveReg()) { 1178 if (Var->mustHaveReg()) {
1179 llvm::report_fatal_error("Infinite-weight Variable (" + Var->getName(Func) + 1179 llvm::report_fatal_error("Infinite-weight Variable (" + Var->getName(Func) +
1180 ") has no register assigned - function " + 1180 ") has no register assigned - function " +
1181 Func->getFunctionName()); 1181 Func->getFunctionName());
1182 } 1182 }
1183 assert(!Var->isRematerializable()); 1183 assert(!Var->isRematerializable());
1184 int32_t Offset = Var->getStackOffset(); 1184 int32_t Offset = Var->getStackOffset();
1185 auto BaseRegNum = Var->getBaseRegNum(); 1185 auto BaseRegNum = Var->getBaseRegNum();
1186 if (BaseRegNum == RegNumT::NoRegister) { 1186 if (BaseRegNum.hasNoValue()) {
1187 BaseRegNum = getFrameOrStackReg(); 1187 BaseRegNum = getFrameOrStackReg();
1188 } 1188 }
1189 const Type VarTy = Var->getType(); 1189 const Type VarTy = Var->getType();
1190 Str << "[" << getRegName(BaseRegNum, VarTy); 1190 Str << "[" << getRegName(BaseRegNum, VarTy);
1191 if (Offset != 0) { 1191 if (Offset != 0) {
1192 Str << ", #" << Offset; 1192 Str << ", #" << Offset;
1193 } 1193 }
1194 Str << "]"; 1194 Str << "]";
1195 } 1195 }
1196 1196
(...skipping 4612 matching lines...) Expand 10 before | Expand all | Expand 10 after
5809 // TODO(jpp): remove unneeded else clauses in legalize. 5809 // TODO(jpp): remove unneeded else clauses in legalize.
5810 Operand *TargetARM32::legalize(Operand *From, LegalMask Allowed, 5810 Operand *TargetARM32::legalize(Operand *From, LegalMask Allowed,
5811 RegNumT RegNum) { 5811 RegNumT RegNum) {
5812 Type Ty = From->getType(); 5812 Type Ty = From->getType();
5813 // Assert that a physical register is allowed. To date, all calls to 5813 // Assert that a physical register is allowed. To date, all calls to
5814 // legalize() allow a physical register. Legal_Flex converts registers to the 5814 // legalize() allow a physical register. Legal_Flex converts registers to the
5815 // right type OperandARM32FlexReg as needed. 5815 // right type OperandARM32FlexReg as needed.
5816 assert(Allowed & Legal_Reg); 5816 assert(Allowed & Legal_Reg);
5817 5817
5818 // Copied ipsis literis from TargetX86Base<Machine>. 5818 // Copied ipsis literis from TargetX86Base<Machine>.
5819 if (RegNum == RegNumT::NoRegister) { 5819 if (RegNum.hasNoValue()) {
5820 if (Variable *Subst = getContext().availabilityGet(From)) { 5820 if (Variable *Subst = getContext().availabilityGet(From)) {
5821 // At this point we know there is a potential substitution available. 5821 // At this point we know there is a potential substitution available.
5822 if (!Subst->isRematerializable() && Subst->mustHaveReg() && 5822 if (!Subst->isRematerializable() && Subst->mustHaveReg() &&
5823 !Subst->hasReg()) { 5823 !Subst->hasReg()) {
5824 // At this point we know the substitution will have a register. 5824 // At this point we know the substitution will have a register.
5825 if (From->getType() == Subst->getType()) { 5825 if (From->getType() == Subst->getType()) {
5826 // At this point we know the substitution's register is compatible. 5826 // At this point we know the substitution's register is compatible.
5827 return Subst; 5827 return Subst;
5828 } 5828 }
5829 } 5829 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
6011 } 6011 }
6012 // Check if the variable is guaranteed a physical register. This can happen 6012 // Check if the variable is guaranteed a physical register. This can happen
6013 // either when the variable is pre-colored or when it is assigned infinite 6013 // either when the variable is pre-colored or when it is assigned infinite
6014 // weight. 6014 // weight.
6015 bool MustHaveRegister = (Var->hasReg() || Var->mustHaveReg()); 6015 bool MustHaveRegister = (Var->hasReg() || Var->mustHaveReg());
6016 // We need a new physical register for the operand if: 6016 // We need a new physical register for the operand if:
6017 // Mem is not allowed and Var isn't guaranteed a physical 6017 // Mem is not allowed and Var isn't guaranteed a physical
6018 // register, or 6018 // register, or
6019 // RegNum is required and Var->getRegNum() doesn't match. 6019 // RegNum is required and Var->getRegNum() doesn't match.
6020 if ((!(Allowed & Legal_Mem) && !MustHaveRegister) || 6020 if ((!(Allowed & Legal_Mem) && !MustHaveRegister) ||
6021 (RegNum != RegNumT::NoRegister && RegNum != Var->getRegNum())) { 6021 (RegNum.hasValue() && (RegNum != Var->getRegNum()))) {
6022 From = copyToReg(From, RegNum); 6022 From = copyToReg(From, RegNum);
6023 } 6023 }
6024 return From; 6024 return From;
6025 } 6025 }
6026 llvm::report_fatal_error("Unhandled operand kind in legalize()"); 6026 llvm::report_fatal_error("Unhandled operand kind in legalize()");
6027 6027
6028 return From; 6028 return From;
6029 } 6029 }
6030 6030
6031 /// Provide a trivial wrapper to legalize() for this common usage. 6031 /// Provide a trivial wrapper to legalize() for this common usage.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
6078 Reg->setMustHaveReg(); 6078 Reg->setMustHaveReg();
6079 Reg->initHiLo(Func); 6079 Reg->initHiLo(Func);
6080 Reg->getLo()->setMustNotHaveReg(); 6080 Reg->getLo()->setMustNotHaveReg();
6081 Reg->getHi()->setMustNotHaveReg(); 6081 Reg->getHi()->setMustNotHaveReg();
6082 return Reg; 6082 return Reg;
6083 } 6083 }
6084 6084
6085 Variable *TargetARM32::makeReg(Type Type, RegNumT RegNum) { 6085 Variable *TargetARM32::makeReg(Type Type, RegNumT RegNum) {
6086 // There aren't any 64-bit integer registers for ARM32. 6086 // There aren't any 64-bit integer registers for ARM32.
6087 assert(Type != IceType_i64); 6087 assert(Type != IceType_i64);
6088 assert(AllowTemporaryWithNoReg || RegNum != RegNumT::NoRegister); 6088 assert(AllowTemporaryWithNoReg || RegNum.hasValue());
6089 Variable *Reg = Func->makeVariable(Type); 6089 Variable *Reg = Func->makeVariable(Type);
6090 if (RegNum == RegNumT::NoRegister) 6090 if (RegNum.hasValue())
6091 Reg->setRegNum(RegNum);
6092 else
6091 Reg->setMustHaveReg(); 6093 Reg->setMustHaveReg();
6092 else
6093 Reg->setRegNum(RegNum);
6094 return Reg; 6094 return Reg;
6095 } 6095 }
6096 6096
6097 void TargetARM32::alignRegisterPow2(Variable *Reg, uint32_t Align, 6097 void TargetARM32::alignRegisterPow2(Variable *Reg, uint32_t Align,
6098 RegNumT TmpRegNum) { 6098 RegNumT TmpRegNum) {
6099 assert(llvm::isPowerOf2_32(Align)); 6099 assert(llvm::isPowerOf2_32(Align));
6100 uint32_t RotateAmt; 6100 uint32_t RotateAmt;
6101 uint32_t Immed_8; 6101 uint32_t Immed_8;
6102 Operand *Mask; 6102 Operand *Mask;
6103 // Use AND or BIC to mask off the bits, depending on which immediate fits (if 6103 // Use AND or BIC to mask off the bits, depending on which immediate fits (if
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
6870 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 6870 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
6871 } 6871 }
6872 6872
6873 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; 6873 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM];
6874 llvm::SmallBitVector 6874 llvm::SmallBitVector
6875 TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; 6875 TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM];
6876 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; 6876 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM];
6877 6877
6878 } // end of namespace ARM32 6878 } // end of namespace ARM32
6879 } // end of namespace Ice 6879 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringARM32.h ('k') | src/IceTargetLoweringMIPS32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698