OLD | NEW |
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 3574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3585 case CondARM32::kNone: | 3585 case CondARM32::kNone: |
3586 _br(TargetFalse); | 3586 _br(TargetFalse); |
3587 break; | 3587 break; |
3588 case CondARM32::AL: | 3588 case CondARM32::AL: |
3589 _br(TargetTrue); | 3589 _br(TargetTrue); |
3590 break; | 3590 break; |
3591 } | 3591 } |
3592 } | 3592 } |
3593 | 3593 |
3594 void TargetARM32::lowerCall(const InstCall *Instr) { | 3594 void TargetARM32::lowerCall(const InstCall *Instr) { |
3595 // Note: Keep original call target. This allows us to call the correct | 3595 Operand *CallTarget = Instr->getCallTarget(); |
3596 // postamble helper, even if the CallTarget gets modified during lowering. | |
3597 Operand *OrigCallTarget = Instr->getCallTarget(); | |
3598 Operand *CallTarget = OrigCallTarget; | |
3599 if (Instr->isTargetHelperCall()) { | 3596 if (Instr->isTargetHelperCall()) { |
3600 auto TargetHelperPreamble = ARM32HelpersPreamble.find(CallTarget); | 3597 auto TargetHelperPreamble = ARM32HelpersPreamble.find(CallTarget); |
3601 if (TargetHelperPreamble != ARM32HelpersPreamble.end()) { | 3598 if (TargetHelperPreamble != ARM32HelpersPreamble.end()) { |
3602 (this->*TargetHelperPreamble->second)(Instr); | 3599 (this->*TargetHelperPreamble->second)(Instr); |
3603 } | 3600 } |
3604 } | 3601 } |
3605 MaybeLeafFunc = false; | 3602 MaybeLeafFunc = false; |
3606 NeedsStackAlignment = true; | 3603 NeedsStackAlignment = true; |
3607 | 3604 |
3608 // Assign arguments to registers and stack. Also reserve stack. | 3605 // Assign arguments to registers and stack. Also reserve stack. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3713 case IceType_v16i1: | 3710 case IceType_v16i1: |
3714 case IceType_v16i8: | 3711 case IceType_v16i8: |
3715 case IceType_v8i16: | 3712 case IceType_v8i16: |
3716 case IceType_v4i32: | 3713 case IceType_v4i32: |
3717 case IceType_v4f32: | 3714 case IceType_v4f32: |
3718 ReturnReg = makeReg(Dest->getType(), RegARM32::Reg_q0); | 3715 ReturnReg = makeReg(Dest->getType(), RegARM32::Reg_q0); |
3719 break; | 3716 break; |
3720 } | 3717 } |
3721 } | 3718 } |
3722 | 3719 |
3723 // Note: To allow far calls, even for constant relocatables, we force | 3720 // Allow ConstantRelocatable to be left alone as a direct call, but force |
3724 // the call target into a register, and make an indirect call. | 3721 // other constants like ConstantInteger32 to be in a register and make it an |
3725 CallTarget = legalizeToReg(CallTarget); | 3722 // indirect call. |
| 3723 if (!llvm::isa<ConstantRelocatable>(CallTarget)) { |
| 3724 CallTarget = legalize(CallTarget, Legal_Reg); |
| 3725 } |
3726 | 3726 |
3727 // Copy arguments to be passed in registers to the appropriate registers. | 3727 // Copy arguments to be passed in registers to the appropriate registers. |
3728 CfgVector<Variable *> RegArgs; | 3728 CfgVector<Variable *> RegArgs; |
3729 for (auto &FPArg : FPArgs) { | 3729 for (auto &FPArg : FPArgs) { |
3730 RegArgs.emplace_back(legalizeToReg(FPArg.first, FPArg.second)); | 3730 RegArgs.emplace_back(legalizeToReg(FPArg.first, FPArg.second)); |
3731 } | 3731 } |
3732 for (auto &GPRArg : GPRArgs) { | 3732 for (auto &GPRArg : GPRArgs) { |
3733 RegArgs.emplace_back(legalizeToReg(GPRArg.first, GPRArg.second)); | 3733 RegArgs.emplace_back(legalizeToReg(GPRArg.first, GPRArg.second)); |
3734 } | 3734 } |
3735 | 3735 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3770 } else { | 3770 } else { |
3771 assert(isIntegerType(Dest->getType()) && | 3771 assert(isIntegerType(Dest->getType()) && |
3772 typeWidthInBytes(Dest->getType()) <= 4); | 3772 typeWidthInBytes(Dest->getType()) <= 4); |
3773 _mov(Dest, ReturnReg); | 3773 _mov(Dest, ReturnReg); |
3774 } | 3774 } |
3775 } | 3775 } |
3776 } | 3776 } |
3777 } | 3777 } |
3778 | 3778 |
3779 if (Instr->isTargetHelperCall()) { | 3779 if (Instr->isTargetHelperCall()) { |
3780 auto TargetHelpersPostamble = ARM32HelpersPostamble.find(OrigCallTarget); | 3780 auto TargetHelpersPostamble = ARM32HelpersPostamble.find(CallTarget); |
3781 if (TargetHelpersPostamble != ARM32HelpersPostamble.end()) { | 3781 if (TargetHelpersPostamble != ARM32HelpersPostamble.end()) { |
3782 (this->*TargetHelpersPostamble->second)(Instr); | 3782 (this->*TargetHelpersPostamble->second)(Instr); |
3783 } | 3783 } |
3784 } | 3784 } |
3785 } | 3785 } |
3786 | 3786 |
3787 namespace { | 3787 namespace { |
3788 void configureBitcastTemporary(Variable64On32 *Var) { | 3788 void configureBitcastTemporary(Variable64On32 *Var) { |
3789 Var->setMustNotHaveReg(); | 3789 Var->setMustNotHaveReg(); |
3790 Var->getHi()->setMustHaveReg(); | 3790 Var->getHi()->setMustHaveReg(); |
(...skipping 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6796 // However, for compatibility with current NaCl LLVM, don't claim that. | 6796 // However, for compatibility with current NaCl LLVM, don't claim that. |
6797 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; | 6797 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
6798 } | 6798 } |
6799 | 6799 |
6800 SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; | 6800 SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; |
6801 SmallBitVector TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; | 6801 SmallBitVector TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; |
6802 SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; | 6802 SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; |
6803 | 6803 |
6804 } // end of namespace ARM32 | 6804 } // end of namespace ARM32 |
6805 } // end of namespace Ice | 6805 } // end of namespace Ice |
OLD | NEW |