OLD | NEW |
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 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2974 return; | 2974 return; |
2975 } | 2975 } |
2976 Variable *Dest = Instr->getDest(); | 2976 Variable *Dest = Instr->getDest(); |
2977 if (Dest->getType() == IceType_i64) { | 2977 if (Dest->getType() == IceType_i64) { |
2978 // Follow what GCC does and use a movq instead of what lowerLoad() | 2978 // Follow what GCC does and use a movq instead of what lowerLoad() |
2979 // normally does (split the load into two). | 2979 // normally does (split the load into two). |
2980 // Thus, this skips load/arithmetic op folding. Load/arithmetic folding | 2980 // Thus, this skips load/arithmetic op folding. Load/arithmetic folding |
2981 // can't happen anyway, since this is x86-32 and integer arithmetic only | 2981 // can't happen anyway, since this is x86-32 and integer arithmetic only |
2982 // happens on 32-bit quantities. | 2982 // happens on 32-bit quantities. |
2983 Variable *T = makeReg(IceType_f64); | 2983 Variable *T = makeReg(IceType_f64); |
2984 OperandX8632Mem *Addr = FormMemoryOperand(Instr->getArg(0), IceType_f64); | 2984 OperandX8632Mem *Addr = formMemoryOperand(Instr->getArg(0), IceType_f64); |
2985 _movq(T, Addr); | 2985 _movq(T, Addr); |
2986 // Then cast the bits back out of the XMM register to the i64 Dest. | 2986 // Then cast the bits back out of the XMM register to the i64 Dest. |
2987 InstCast *Cast = InstCast::create(Func, InstCast::Bitcast, Dest, T); | 2987 InstCast *Cast = InstCast::create(Func, InstCast::Bitcast, Dest, T); |
2988 lowerCast(Cast); | 2988 lowerCast(Cast); |
2989 // Make sure that the atomic load isn't elided when unused. | 2989 // Make sure that the atomic load isn't elided when unused. |
2990 Context.insert(InstFakeUse::create(Func, Dest->getLo())); | 2990 Context.insert(InstFakeUse::create(Func, Dest->getLo())); |
2991 Context.insert(InstFakeUse::create(Func, Dest->getHi())); | 2991 Context.insert(InstFakeUse::create(Func, Dest->getHi())); |
2992 return; | 2992 return; |
2993 } | 2993 } |
2994 InstLoad *Load = InstLoad::create(Func, Dest, Instr->getArg(0)); | 2994 InstLoad *Load = InstLoad::create(Func, Dest, Instr->getArg(0)); |
(...skipping 28 matching lines...) Expand all Loading... |
3023 Operand *Value = Instr->getArg(0); | 3023 Operand *Value = Instr->getArg(0); |
3024 Operand *Ptr = Instr->getArg(1); | 3024 Operand *Ptr = Instr->getArg(1); |
3025 if (Value->getType() == IceType_i64) { | 3025 if (Value->getType() == IceType_i64) { |
3026 // Use a movq instead of what lowerStore() normally does | 3026 // Use a movq instead of what lowerStore() normally does |
3027 // (split the store into two), following what GCC does. | 3027 // (split the store into two), following what GCC does. |
3028 // Cast the bits from int -> to an xmm register first. | 3028 // Cast the bits from int -> to an xmm register first. |
3029 Variable *T = makeReg(IceType_f64); | 3029 Variable *T = makeReg(IceType_f64); |
3030 InstCast *Cast = InstCast::create(Func, InstCast::Bitcast, T, Value); | 3030 InstCast *Cast = InstCast::create(Func, InstCast::Bitcast, T, Value); |
3031 lowerCast(Cast); | 3031 lowerCast(Cast); |
3032 // Then store XMM w/ a movq. | 3032 // Then store XMM w/ a movq. |
3033 OperandX8632Mem *Addr = FormMemoryOperand(Ptr, IceType_f64); | 3033 OperandX8632Mem *Addr = formMemoryOperand(Ptr, IceType_f64); |
3034 _storeq(T, Addr); | 3034 _storeq(T, Addr); |
3035 _mfence(); | 3035 _mfence(); |
3036 return; | 3036 return; |
3037 } | 3037 } |
3038 InstStore *Store = InstStore::create(Func, Value, Ptr); | 3038 InstStore *Store = InstStore::create(Func, Value, Ptr); |
3039 lowerStore(Store); | 3039 lowerStore(Store); |
3040 _mfence(); | 3040 _mfence(); |
3041 return; | 3041 return; |
3042 } | 3042 } |
3043 case Intrinsics::Bswap: { | 3043 case Intrinsics::Bswap: { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3232 Func->setError("Should not be lowering UnknownIntrinsic"); | 3232 Func->setError("Should not be lowering UnknownIntrinsic"); |
3233 return; | 3233 return; |
3234 } | 3234 } |
3235 return; | 3235 return; |
3236 } | 3236 } |
3237 | 3237 |
3238 void TargetX8632::lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, | 3238 void TargetX8632::lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, |
3239 Operand *Expected, Operand *Desired) { | 3239 Operand *Expected, Operand *Desired) { |
3240 if (Expected->getType() == IceType_i64) { | 3240 if (Expected->getType() == IceType_i64) { |
3241 // Reserve the pre-colored registers first, before adding any more | 3241 // Reserve the pre-colored registers first, before adding any more |
3242 // infinite-weight variables from FormMemoryOperand's legalization. | 3242 // infinite-weight variables from formMemoryOperand's legalization. |
3243 Variable *T_edx = makeReg(IceType_i32, RegX8632::Reg_edx); | 3243 Variable *T_edx = makeReg(IceType_i32, RegX8632::Reg_edx); |
3244 Variable *T_eax = makeReg(IceType_i32, RegX8632::Reg_eax); | 3244 Variable *T_eax = makeReg(IceType_i32, RegX8632::Reg_eax); |
3245 Variable *T_ecx = makeReg(IceType_i32, RegX8632::Reg_ecx); | 3245 Variable *T_ecx = makeReg(IceType_i32, RegX8632::Reg_ecx); |
3246 Variable *T_ebx = makeReg(IceType_i32, RegX8632::Reg_ebx); | 3246 Variable *T_ebx = makeReg(IceType_i32, RegX8632::Reg_ebx); |
3247 _mov(T_eax, loOperand(Expected)); | 3247 _mov(T_eax, loOperand(Expected)); |
3248 _mov(T_edx, hiOperand(Expected)); | 3248 _mov(T_edx, hiOperand(Expected)); |
3249 _mov(T_ebx, loOperand(Desired)); | 3249 _mov(T_ebx, loOperand(Desired)); |
3250 _mov(T_ecx, hiOperand(Desired)); | 3250 _mov(T_ecx, hiOperand(Desired)); |
3251 OperandX8632Mem *Addr = FormMemoryOperand(Ptr, Expected->getType()); | 3251 OperandX8632Mem *Addr = formMemoryOperand(Ptr, Expected->getType()); |
3252 const bool Locked = true; | 3252 const bool Locked = true; |
3253 _cmpxchg8b(Addr, T_edx, T_eax, T_ecx, T_ebx, Locked); | 3253 _cmpxchg8b(Addr, T_edx, T_eax, T_ecx, T_ebx, Locked); |
3254 Variable *DestLo = llvm::cast<Variable>(loOperand(DestPrev)); | 3254 Variable *DestLo = llvm::cast<Variable>(loOperand(DestPrev)); |
3255 Variable *DestHi = llvm::cast<Variable>(hiOperand(DestPrev)); | 3255 Variable *DestHi = llvm::cast<Variable>(hiOperand(DestPrev)); |
3256 _mov(DestLo, T_eax); | 3256 _mov(DestLo, T_eax); |
3257 _mov(DestHi, T_edx); | 3257 _mov(DestHi, T_edx); |
3258 return; | 3258 return; |
3259 } | 3259 } |
3260 Variable *T_eax = makeReg(Expected->getType(), RegX8632::Reg_eax); | 3260 Variable *T_eax = makeReg(Expected->getType(), RegX8632::Reg_eax); |
3261 _mov(T_eax, Expected); | 3261 _mov(T_eax, Expected); |
3262 OperandX8632Mem *Addr = FormMemoryOperand(Ptr, Expected->getType()); | 3262 OperandX8632Mem *Addr = formMemoryOperand(Ptr, Expected->getType()); |
3263 Variable *DesiredReg = legalizeToVar(Desired); | 3263 Variable *DesiredReg = legalizeToVar(Desired); |
3264 const bool Locked = true; | 3264 const bool Locked = true; |
3265 _cmpxchg(Addr, T_eax, DesiredReg, Locked); | 3265 _cmpxchg(Addr, T_eax, DesiredReg, Locked); |
3266 _mov(DestPrev, T_eax); | 3266 _mov(DestPrev, T_eax); |
3267 } | 3267 } |
3268 | 3268 |
3269 bool TargetX8632::tryOptimizedCmpxchgCmpBr(Variable *Dest, Operand *PtrToMem, | 3269 bool TargetX8632::tryOptimizedCmpxchgCmpBr(Variable *Dest, Operand *PtrToMem, |
3270 Operand *Expected, | 3270 Operand *Expected, |
3271 Operand *Desired) { | 3271 Operand *Desired) { |
3272 if (Ctx->getFlags().getOptLevel() == Opt_m1) | 3272 if (Ctx->getFlags().getOptLevel() == Opt_m1) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3350 return; | 3350 return; |
3351 case Intrinsics::AtomicAdd: { | 3351 case Intrinsics::AtomicAdd: { |
3352 if (Dest->getType() == IceType_i64) { | 3352 if (Dest->getType() == IceType_i64) { |
3353 // All the fall-through paths must set this to true, but use this | 3353 // All the fall-through paths must set this to true, but use this |
3354 // for asserting. | 3354 // for asserting. |
3355 NeedsCmpxchg = true; | 3355 NeedsCmpxchg = true; |
3356 Op_Lo = &TargetX8632::_add; | 3356 Op_Lo = &TargetX8632::_add; |
3357 Op_Hi = &TargetX8632::_adc; | 3357 Op_Hi = &TargetX8632::_adc; |
3358 break; | 3358 break; |
3359 } | 3359 } |
3360 OperandX8632Mem *Addr = FormMemoryOperand(Ptr, Dest->getType()); | 3360 OperandX8632Mem *Addr = formMemoryOperand(Ptr, Dest->getType()); |
3361 const bool Locked = true; | 3361 const bool Locked = true; |
3362 Variable *T = nullptr; | 3362 Variable *T = nullptr; |
3363 _mov(T, Val); | 3363 _mov(T, Val); |
3364 _xadd(Addr, T, Locked); | 3364 _xadd(Addr, T, Locked); |
3365 _mov(Dest, T); | 3365 _mov(Dest, T); |
3366 return; | 3366 return; |
3367 } | 3367 } |
3368 case Intrinsics::AtomicSub: { | 3368 case Intrinsics::AtomicSub: { |
3369 if (Dest->getType() == IceType_i64) { | 3369 if (Dest->getType() == IceType_i64) { |
3370 NeedsCmpxchg = true; | 3370 NeedsCmpxchg = true; |
3371 Op_Lo = &TargetX8632::_sub; | 3371 Op_Lo = &TargetX8632::_sub; |
3372 Op_Hi = &TargetX8632::_sbb; | 3372 Op_Hi = &TargetX8632::_sbb; |
3373 break; | 3373 break; |
3374 } | 3374 } |
3375 OperandX8632Mem *Addr = FormMemoryOperand(Ptr, Dest->getType()); | 3375 OperandX8632Mem *Addr = formMemoryOperand(Ptr, Dest->getType()); |
3376 const bool Locked = true; | 3376 const bool Locked = true; |
3377 Variable *T = nullptr; | 3377 Variable *T = nullptr; |
3378 _mov(T, Val); | 3378 _mov(T, Val); |
3379 _neg(T); | 3379 _neg(T); |
3380 _xadd(Addr, T, Locked); | 3380 _xadd(Addr, T, Locked); |
3381 _mov(Dest, T); | 3381 _mov(Dest, T); |
3382 return; | 3382 return; |
3383 } | 3383 } |
3384 case Intrinsics::AtomicOr: | 3384 case Intrinsics::AtomicOr: |
3385 // TODO(jvoung): If Dest is null or dead, then some of these | 3385 // TODO(jvoung): If Dest is null or dead, then some of these |
(...skipping 17 matching lines...) Expand all Loading... |
3403 break; | 3403 break; |
3404 case Intrinsics::AtomicExchange: | 3404 case Intrinsics::AtomicExchange: |
3405 if (Dest->getType() == IceType_i64) { | 3405 if (Dest->getType() == IceType_i64) { |
3406 NeedsCmpxchg = true; | 3406 NeedsCmpxchg = true; |
3407 // NeedsCmpxchg, but no real Op_Lo/Op_Hi need to be done. The values | 3407 // NeedsCmpxchg, but no real Op_Lo/Op_Hi need to be done. The values |
3408 // just need to be moved to the ecx and ebx registers. | 3408 // just need to be moved to the ecx and ebx registers. |
3409 Op_Lo = nullptr; | 3409 Op_Lo = nullptr; |
3410 Op_Hi = nullptr; | 3410 Op_Hi = nullptr; |
3411 break; | 3411 break; |
3412 } | 3412 } |
3413 OperandX8632Mem *Addr = FormMemoryOperand(Ptr, Dest->getType()); | 3413 OperandX8632Mem *Addr = formMemoryOperand(Ptr, Dest->getType()); |
3414 Variable *T = nullptr; | 3414 Variable *T = nullptr; |
3415 _mov(T, Val); | 3415 _mov(T, Val); |
3416 _xchg(Addr, T); | 3416 _xchg(Addr, T); |
3417 _mov(Dest, T); | 3417 _mov(Dest, T); |
3418 return; | 3418 return; |
3419 } | 3419 } |
3420 // Otherwise, we need a cmpxchg loop. | 3420 // Otherwise, we need a cmpxchg loop. |
3421 (void)NeedsCmpxchg; | 3421 (void)NeedsCmpxchg; |
3422 assert(NeedsCmpxchg); | 3422 assert(NeedsCmpxchg); |
3423 expandAtomicRMWAsCmpxchg(Op_Lo, Op_Hi, Dest, Ptr, Val); | 3423 expandAtomicRMWAsCmpxchg(Op_Lo, Op_Hi, Dest, Ptr, Val); |
(...skipping 24 matching lines...) Expand all Loading... |
3448 // lock cmpxchg [ptr], <reg> | 3448 // lock cmpxchg [ptr], <reg> |
3449 // jne .LABEL | 3449 // jne .LABEL |
3450 // mov <dest>, eax | 3450 // mov <dest>, eax |
3451 // | 3451 // |
3452 // If Op_{Lo,Hi} are nullptr, then just copy the value. | 3452 // If Op_{Lo,Hi} are nullptr, then just copy the value. |
3453 Val = legalize(Val); | 3453 Val = legalize(Val); |
3454 Type Ty = Val->getType(); | 3454 Type Ty = Val->getType(); |
3455 if (Ty == IceType_i64) { | 3455 if (Ty == IceType_i64) { |
3456 Variable *T_edx = makeReg(IceType_i32, RegX8632::Reg_edx); | 3456 Variable *T_edx = makeReg(IceType_i32, RegX8632::Reg_edx); |
3457 Variable *T_eax = makeReg(IceType_i32, RegX8632::Reg_eax); | 3457 Variable *T_eax = makeReg(IceType_i32, RegX8632::Reg_eax); |
3458 OperandX8632Mem *Addr = FormMemoryOperand(Ptr, Ty); | 3458 OperandX8632Mem *Addr = formMemoryOperand(Ptr, Ty); |
3459 _mov(T_eax, loOperand(Addr)); | 3459 _mov(T_eax, loOperand(Addr)); |
3460 _mov(T_edx, hiOperand(Addr)); | 3460 _mov(T_edx, hiOperand(Addr)); |
3461 Variable *T_ecx = makeReg(IceType_i32, RegX8632::Reg_ecx); | 3461 Variable *T_ecx = makeReg(IceType_i32, RegX8632::Reg_ecx); |
3462 Variable *T_ebx = makeReg(IceType_i32, RegX8632::Reg_ebx); | 3462 Variable *T_ebx = makeReg(IceType_i32, RegX8632::Reg_ebx); |
3463 InstX8632Label *Label = InstX8632Label::create(Func, this); | 3463 InstX8632Label *Label = InstX8632Label::create(Func, this); |
3464 const bool IsXchg8b = Op_Lo == nullptr && Op_Hi == nullptr; | 3464 const bool IsXchg8b = Op_Lo == nullptr && Op_Hi == nullptr; |
3465 if (!IsXchg8b) { | 3465 if (!IsXchg8b) { |
3466 Context.insert(Label); | 3466 Context.insert(Label); |
3467 _mov(T_ebx, T_eax); | 3467 _mov(T_ebx, T_eax); |
3468 (this->*Op_Lo)(T_ebx, loOperand(Val)); | 3468 (this->*Op_Lo)(T_ebx, loOperand(Val)); |
(...skipping 26 matching lines...) Expand all Loading... |
3495 } | 3495 } |
3496 // The address base (if any) is also reused in the loop. | 3496 // The address base (if any) is also reused in the loop. |
3497 if (Variable *Base = Addr->getBase()) | 3497 if (Variable *Base = Addr->getBase()) |
3498 Context.insert(InstFakeUse::create(Func, Base)); | 3498 Context.insert(InstFakeUse::create(Func, Base)); |
3499 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); | 3499 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); |
3500 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); | 3500 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); |
3501 _mov(DestLo, T_eax); | 3501 _mov(DestLo, T_eax); |
3502 _mov(DestHi, T_edx); | 3502 _mov(DestHi, T_edx); |
3503 return; | 3503 return; |
3504 } | 3504 } |
3505 OperandX8632Mem *Addr = FormMemoryOperand(Ptr, Ty); | 3505 OperandX8632Mem *Addr = formMemoryOperand(Ptr, Ty); |
3506 Variable *T_eax = makeReg(Ty, RegX8632::Reg_eax); | 3506 Variable *T_eax = makeReg(Ty, RegX8632::Reg_eax); |
3507 _mov(T_eax, Addr); | 3507 _mov(T_eax, Addr); |
3508 InstX8632Label *Label = InstX8632Label::create(Func, this); | 3508 InstX8632Label *Label = InstX8632Label::create(Func, this); |
3509 Context.insert(Label); | 3509 Context.insert(Label); |
3510 // We want to pick a different register for T than Eax, so don't use | 3510 // We want to pick a different register for T than Eax, so don't use |
3511 // _mov(T == nullptr, T_eax). | 3511 // _mov(T == nullptr, T_eax). |
3512 Variable *T = makeReg(Ty); | 3512 Variable *T = makeReg(Ty); |
3513 _mov(T, T_eax); | 3513 _mov(T, T_eax); |
3514 (this->*Op_Lo)(T, Val); | 3514 (this->*Op_Lo)(T, Val); |
3515 const bool Locked = true; | 3515 const bool Locked = true; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3846 | 3846 |
3847 } // anonymous namespace | 3847 } // anonymous namespace |
3848 | 3848 |
3849 void TargetX8632::lowerLoad(const InstLoad *Load) { | 3849 void TargetX8632::lowerLoad(const InstLoad *Load) { |
3850 // A Load instruction can be treated the same as an Assign | 3850 // A Load instruction can be treated the same as an Assign |
3851 // instruction, after the source operand is transformed into an | 3851 // instruction, after the source operand is transformed into an |
3852 // OperandX8632Mem operand. Note that the address mode | 3852 // OperandX8632Mem operand. Note that the address mode |
3853 // optimization already creates an OperandX8632Mem operand, so it | 3853 // optimization already creates an OperandX8632Mem operand, so it |
3854 // doesn't need another level of transformation. | 3854 // doesn't need another level of transformation. |
3855 Type Ty = Load->getDest()->getType(); | 3855 Type Ty = Load->getDest()->getType(); |
3856 Operand *Src0 = FormMemoryOperand(Load->getSourceAddress(), Ty); | 3856 Operand *Src0 = formMemoryOperand(Load->getSourceAddress(), Ty); |
3857 | 3857 |
3858 // Fuse this load with a subsequent Arithmetic instruction in the | 3858 // Fuse this load with a subsequent Arithmetic instruction in the |
3859 // following situations: | 3859 // following situations: |
3860 // a=[mem]; c=b+a ==> c=b+[mem] if last use of a and a not in b | 3860 // a=[mem]; c=b+a ==> c=b+[mem] if last use of a and a not in b |
3861 // a=[mem]; c=a+b ==> c=b+[mem] if commutative and above is true | 3861 // a=[mem]; c=a+b ==> c=b+[mem] if commutative and above is true |
3862 // | 3862 // |
3863 // Fuse this load with a subsequent Cast instruction: | 3863 // Fuse this load with a subsequent Cast instruction: |
3864 // a=[mem]; b=cast(a) ==> b=cast([mem]) if last use of a | 3864 // a=[mem]; b=cast(a) ==> b=cast([mem]) if last use of a |
3865 // | 3865 // |
3866 // TODO: Clean up and test thoroughly. | 3866 // TODO: Clean up and test thoroughly. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4117 SrcF = legalize(SrcF); | 4117 SrcF = legalize(SrcF); |
4118 _mov(T, SrcF); | 4118 _mov(T, SrcF); |
4119 SrcT = legalize(SrcT, Legal_Reg | Legal_Mem); | 4119 SrcT = legalize(SrcT, Legal_Reg | Legal_Mem); |
4120 _cmov(T, SrcT, Cond); | 4120 _cmov(T, SrcT, Cond); |
4121 _mov(Dest, T); | 4121 _mov(Dest, T); |
4122 } | 4122 } |
4123 | 4123 |
4124 void TargetX8632::lowerStore(const InstStore *Inst) { | 4124 void TargetX8632::lowerStore(const InstStore *Inst) { |
4125 Operand *Value = Inst->getData(); | 4125 Operand *Value = Inst->getData(); |
4126 Operand *Addr = Inst->getAddr(); | 4126 Operand *Addr = Inst->getAddr(); |
4127 OperandX8632Mem *NewAddr = FormMemoryOperand(Addr, Value->getType()); | 4127 OperandX8632Mem *NewAddr = formMemoryOperand(Addr, Value->getType()); |
4128 Type Ty = NewAddr->getType(); | 4128 Type Ty = NewAddr->getType(); |
4129 | 4129 |
4130 if (Ty == IceType_i64) { | 4130 if (Ty == IceType_i64) { |
4131 Value = legalize(Value); | 4131 Value = legalize(Value); |
4132 Operand *ValueHi = legalize(hiOperand(Value), Legal_Reg | Legal_Imm); | 4132 Operand *ValueHi = legalize(hiOperand(Value), Legal_Reg | Legal_Imm); |
4133 Operand *ValueLo = legalize(loOperand(Value), Legal_Reg | Legal_Imm); | 4133 Operand *ValueLo = legalize(loOperand(Value), Legal_Reg | Legal_Imm); |
4134 _store(ValueHi, llvm::cast<OperandX8632Mem>(hiOperand(NewAddr))); | 4134 _store(ValueHi, llvm::cast<OperandX8632Mem>(hiOperand(NewAddr))); |
4135 _store(ValueLo, llvm::cast<OperandX8632Mem>(loOperand(NewAddr))); | 4135 _store(ValueLo, llvm::cast<OperandX8632Mem>(loOperand(NewAddr))); |
4136 } else if (isVectorType(Ty)) { | 4136 } else if (isVectorType(Ty)) { |
4137 _storep(legalizeToVar(Value), NewAddr); | 4137 _storep(legalizeToVar(Value), NewAddr); |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4632 bool IsSrc1ImmOrReg = false; | 4632 bool IsSrc1ImmOrReg = false; |
4633 if (llvm::isa<Constant>(Src1)) { | 4633 if (llvm::isa<Constant>(Src1)) { |
4634 IsSrc1ImmOrReg = true; | 4634 IsSrc1ImmOrReg = true; |
4635 } else if (Variable *Var = llvm::dyn_cast<Variable>(Src1)) { | 4635 } else if (Variable *Var = llvm::dyn_cast<Variable>(Src1)) { |
4636 if (Var->hasReg()) | 4636 if (Var->hasReg()) |
4637 IsSrc1ImmOrReg = true; | 4637 IsSrc1ImmOrReg = true; |
4638 } | 4638 } |
4639 return legalize(Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg); | 4639 return legalize(Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg); |
4640 } | 4640 } |
4641 | 4641 |
4642 OperandX8632Mem *TargetX8632::FormMemoryOperand(Operand *Operand, Type Ty) { | 4642 OperandX8632Mem *TargetX8632::formMemoryOperand(Operand *Operand, Type Ty) { |
4643 OperandX8632Mem *Mem = llvm::dyn_cast<OperandX8632Mem>(Operand); | 4643 OperandX8632Mem *Mem = llvm::dyn_cast<OperandX8632Mem>(Operand); |
4644 // It may be the case that address mode optimization already creates | 4644 // It may be the case that address mode optimization already creates |
4645 // an OperandX8632Mem, so in that case it wouldn't need another level | 4645 // an OperandX8632Mem, so in that case it wouldn't need another level |
4646 // of transformation. | 4646 // of transformation. |
4647 if (!Mem) { | 4647 if (!Mem) { |
4648 Variable *Base = llvm::dyn_cast<Variable>(Operand); | 4648 Variable *Base = llvm::dyn_cast<Variable>(Operand); |
4649 Constant *Offset = llvm::dyn_cast<Constant>(Operand); | 4649 Constant *Offset = llvm::dyn_cast<Constant>(Operand); |
4650 assert(Base || Offset); | 4650 assert(Base || Offset); |
4651 if (Offset) { | 4651 if (Offset) { |
4652 // Make sure Offset is not undef. | 4652 // Make sure Offset is not undef. |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4942 case FT_Asm: | 4942 case FT_Asm: |
4943 case FT_Iasm: { | 4943 case FT_Iasm: { |
4944 OstreamLocker L(Ctx); | 4944 OstreamLocker L(Ctx); |
4945 emitConstantPool<PoolTypeConverter<float>>(Ctx); | 4945 emitConstantPool<PoolTypeConverter<float>>(Ctx); |
4946 emitConstantPool<PoolTypeConverter<double>>(Ctx); | 4946 emitConstantPool<PoolTypeConverter<double>>(Ctx); |
4947 } break; | 4947 } break; |
4948 } | 4948 } |
4949 } | 4949 } |
4950 | 4950 |
4951 } // end of namespace Ice | 4951 } // end of namespace Ice |
OLD | NEW |