Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // | 1 // |
| 2 // The Subzero Code Generator | 2 // The Subzero Code Generator |
| 3 // | 3 // |
| 4 // This file is distributed under the University of Illinois Open Source | 4 // This file is distributed under the University of Illinois Open Source |
| 5 // License. See LICENSE.TXT for details. | 5 // License. See LICENSE.TXT for details. |
| 6 // | 6 // |
| 7 //===----------------------------------------------------------------------===// | 7 //===----------------------------------------------------------------------===// |
| 8 /// | 8 /// |
| 9 /// \file | 9 /// \file |
| 10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost | 10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost |
| (...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2840 case Intrinsics::Bswap: { | 2840 case Intrinsics::Bswap: { |
| 2841 UnimplementedLoweringError(this, Instr); | 2841 UnimplementedLoweringError(this, Instr); |
| 2842 return; | 2842 return; |
| 2843 } | 2843 } |
| 2844 case Intrinsics::Ctpop: { | 2844 case Intrinsics::Ctpop: { |
| 2845 llvm::report_fatal_error("Ctpop should have been prelowered."); | 2845 llvm::report_fatal_error("Ctpop should have been prelowered."); |
| 2846 return; | 2846 return; |
| 2847 } | 2847 } |
| 2848 case Intrinsics::Ctlz: { | 2848 case Intrinsics::Ctlz: { |
| 2849 UnimplementedLoweringError(this, Instr); | 2849 UnimplementedLoweringError(this, Instr); |
| 2850 return; | |
| 2851 } | 2850 } |
| 2852 case Intrinsics::Cttz: { | 2851 case Intrinsics::Cttz: { |
| 2853 UnimplementedLoweringError(this, Instr); | 2852 auto *Src = Instr->getArg(0); |
| 2853 const Type SrcTy = Src->getType(); | |
| 2854 assert(SrcTy == IceType_i32 || SrcTy == IceType_i64); | |
| 2855 switch (SrcTy) { | |
| 2856 case IceType_i32: { | |
| 2857 auto *T1 = I32Reg(); | |
| 2858 auto *T2 = I32Reg(); | |
| 2859 auto *SrcR = legalizeToReg(Src); | |
| 2860 _addiu(T1, SrcR, -1); | |
| 2861 _not(T2, SrcR); | |
| 2862 Context.insert<InstFakeUse>(SrcR); | |
|
Jim Stichnoth
2016/09/23 06:13:47
This FakeUse doesn't seem necessary?
obucinac
2016/09/23 11:37:32
Done.
| |
| 2863 _and(T1, T2, T1); | |
| 2864 _clz(T1, T1); | |
| 2865 _addiu(T2, getZero(), 32); | |
| 2866 _subu(T2, T2, T1); | |
| 2867 _mov(Dest, T2); | |
| 2868 break; | |
| 2869 } | |
| 2870 case IceType_i64: { | |
| 2871 UnimplementedLoweringError(this, Instr); | |
| 2872 break; | |
| 2873 } | |
| 2874 default: | |
| 2875 llvm::report_fatal_error("Control flow should never have reached here."); | |
| 2876 } | |
| 2854 return; | 2877 return; |
| 2855 } | 2878 } |
| 2856 case Intrinsics::Fabs: { | 2879 case Intrinsics::Fabs: { |
| 2857 if (isScalarFloatingType(DestTy)) { | 2880 if (isScalarFloatingType(DestTy)) { |
| 2858 Variable *T = makeReg(DestTy); | 2881 Variable *T = makeReg(DestTy); |
| 2859 if (DestTy == IceType_f32) { | 2882 if (DestTy == IceType_f32) { |
| 2860 _abs_s(T, legalizeToReg(Instr->getArg(0))); | 2883 _abs_s(T, legalizeToReg(Instr->getArg(0))); |
| 2861 } else { | 2884 } else { |
| 2862 _abs_d(T, legalizeToReg(Instr->getArg(0))); | 2885 _abs_d(T, legalizeToReg(Instr->getArg(0))); |
| 2863 } | 2886 } |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3343 // since loOperand() and hiOperand() don't expect Undef input. | 3366 // since loOperand() and hiOperand() don't expect Undef input. |
| 3344 void TargetMIPS32::prelowerPhis() { | 3367 void TargetMIPS32::prelowerPhis() { |
| 3345 PhiLowering::prelowerPhis32Bit<TargetMIPS32>(this, Context.getNode(), Func); | 3368 PhiLowering::prelowerPhis32Bit<TargetMIPS32>(this, Context.getNode(), Func); |
| 3346 } | 3369 } |
| 3347 | 3370 |
| 3348 void TargetMIPS32::postLower() { | 3371 void TargetMIPS32::postLower() { |
| 3349 if (Func->getOptLevel() == Opt_m1) | 3372 if (Func->getOptLevel() == Opt_m1) |
| 3350 return; | 3373 return; |
| 3351 // TODO(rkotler): Find two-address non-SSA instructions where Dest==Src0, | 3374 // TODO(rkotler): Find two-address non-SSA instructions where Dest==Src0, |
| 3352 // and set the IsDestRedefined flag to keep liveness analysis consistent. | 3375 // and set the IsDestRedefined flag to keep liveness analysis consistent. |
| 3353 UnimplementedError(getFlags()); | 3376 markRedefinitions(); |
| 3377 Context.availabilityUpdate(); | |
| 3354 } | 3378 } |
| 3355 | 3379 |
| 3356 void TargetMIPS32::makeRandomRegisterPermutation( | 3380 void TargetMIPS32::makeRandomRegisterPermutation( |
| 3357 llvm::SmallVectorImpl<RegNumT> &Permutation, | 3381 llvm::SmallVectorImpl<RegNumT> &Permutation, |
| 3358 const SmallBitVector &ExcludeRegisters, uint64_t Salt) const { | 3382 const SmallBitVector &ExcludeRegisters, uint64_t Salt) const { |
| 3359 (void)Permutation; | 3383 (void)Permutation; |
| 3360 (void)ExcludeRegisters; | 3384 (void)ExcludeRegisters; |
| 3361 (void)Salt; | 3385 (void)Salt; |
| 3362 UnimplementedError(getFlags()); | 3386 UnimplementedError(getFlags()); |
| 3363 } | 3387 } |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3741 Str << "\t.set\t" | 3765 Str << "\t.set\t" |
| 3742 << "nomips16\n"; | 3766 << "nomips16\n"; |
| 3743 } | 3767 } |
| 3744 | 3768 |
| 3745 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; | 3769 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; |
| 3746 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; | 3770 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; |
| 3747 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; | 3771 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; |
| 3748 | 3772 |
| 3749 } // end of namespace MIPS32 | 3773 } // end of namespace MIPS32 |
| 3750 } // end of namespace Ice | 3774 } // end of namespace Ice |
| OLD | NEW |