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

Side by Side Diff: src/IceTargetLoweringARM32.cpp

Issue 1424873003: Subzero. ARM32. Implements the Availability Optimization. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | tests_lit/llvm2ice_tests/callindirect.pnacl.ll » ('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 3459 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 return Reg; 3470 return Reg;
3471 } 3471 }
3472 3472
3473 Operand *TargetARM32::legalize(Operand *From, LegalMask Allowed, 3473 Operand *TargetARM32::legalize(Operand *From, LegalMask Allowed,
3474 int32_t RegNum) { 3474 int32_t RegNum) {
3475 Type Ty = From->getType(); 3475 Type Ty = From->getType();
3476 // Assert that a physical register is allowed. To date, all calls to 3476 // Assert that a physical register is allowed. To date, all calls to
3477 // legalize() allow a physical register. Legal_Flex converts registers to the 3477 // legalize() allow a physical register. Legal_Flex converts registers to the
3478 // right type OperandARM32FlexReg as needed. 3478 // right type OperandARM32FlexReg as needed.
3479 assert(Allowed & Legal_Reg); 3479 assert(Allowed & Legal_Reg);
3480
3481 // Copied ipsis literis from TargetX86Base<Machine>.
3482 if (RegNum == Variable::NoRegister) {
3483 if (Variable *Subst = getContext().availabilityGet(From)) {
3484 // At this point we know there is a potential substitution available.
3485 if (Subst->mustHaveReg() && !Subst->hasReg()) {
3486 // At this point we know the substitution will have a register.
3487 if (From->getType() == Subst->getType()) {
3488 // At this point we know the substitution's register is compatible.
3489 return Subst;
3490 }
3491 }
3492 }
3493 }
3494
3480 // Go through the various types of operands: OperandARM32Mem, 3495 // Go through the various types of operands: OperandARM32Mem,
3481 // OperandARM32Flex, Constant, and Variable. Given the above assertion, if 3496 // OperandARM32Flex, Constant, and Variable. Given the above assertion, if
3482 // type of operand is not legal (e.g., OperandARM32Mem and !Legal_Mem), we 3497 // type of operand is not legal (e.g., OperandARM32Mem and !Legal_Mem), we
3483 // can always copy to a register. 3498 // can always copy to a register.
3484 if (auto Mem = llvm::dyn_cast<OperandARM32Mem>(From)) { 3499 if (auto Mem = llvm::dyn_cast<OperandARM32Mem>(From)) {
3485 static const struct { 3500 static const struct {
3486 bool CanHaveOffset; 3501 bool CanHaveOffset;
3487 bool CanHaveIndex; 3502 bool CanHaveIndex;
3488 } MemTraits[] = { 3503 } MemTraits[] = {
3489 #define X(tag, elementty, int_width, vec_width, sbits, ubits, rraddr) \ 3504 #define X(tag, elementty, int_width, vec_width, sbits, ubits, rraddr) \
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 } else { 3742 } else {
3728 Mask = legalize(Ctx->getConstantInt32(-Align), Legal_Reg | Legal_Flex); 3743 Mask = legalize(Ctx->getConstantInt32(-Align), Legal_Reg | Legal_Flex);
3729 _and(Reg, Reg, Mask); 3744 _and(Reg, Reg, Mask);
3730 } 3745 }
3731 } 3746 }
3732 3747
3733 void TargetARM32::postLower() { 3748 void TargetARM32::postLower() {
3734 if (Ctx->getFlags().getOptLevel() == Opt_m1) 3749 if (Ctx->getFlags().getOptLevel() == Opt_m1)
3735 return; 3750 return;
3736 markRedefinitions(); 3751 markRedefinitions();
3752 Context.availabilityUpdate();
3737 } 3753 }
3738 3754
3739 void TargetARM32::makeRandomRegisterPermutation( 3755 void TargetARM32::makeRandomRegisterPermutation(
3740 llvm::SmallVectorImpl<int32_t> &Permutation, 3756 llvm::SmallVectorImpl<int32_t> &Permutation,
3741 const llvm::SmallBitVector &ExcludeRegisters, uint64_t Salt) const { 3757 const llvm::SmallBitVector &ExcludeRegisters, uint64_t Salt) const {
3742 (void)Permutation; 3758 (void)Permutation;
3743 (void)ExcludeRegisters; 3759 (void)ExcludeRegisters;
3744 (void)Salt; 3760 (void)Salt;
3745 UnimplementedError(Func->getContext()->getFlags()); 3761 UnimplementedError(Func->getContext()->getFlags());
3746 } 3762 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3954 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n"; 3970 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n";
3955 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) { 3971 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) {
3956 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n"; 3972 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n";
3957 } 3973 }
3958 // Technically R9 is used for TLS with Sandboxing, and we reserve it. 3974 // Technically R9 is used for TLS with Sandboxing, and we reserve it.
3959 // However, for compatibility with current NaCl LLVM, don't claim that. 3975 // However, for compatibility with current NaCl LLVM, don't claim that.
3960 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 3976 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
3961 } 3977 }
3962 3978
3963 } // end of namespace Ice 3979 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/callindirect.pnacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698