OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// | 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// |
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 3503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3514 } | 3514 } |
3515 case Intrinsics::Memmove: { | 3515 case Intrinsics::Memmove: { |
3516 InstCall *Call = makeHelperCall(H_call_memmove, nullptr, 3); | 3516 InstCall *Call = makeHelperCall(H_call_memmove, nullptr, 3); |
3517 Call->addArg(Instr->getArg(0)); | 3517 Call->addArg(Instr->getArg(0)); |
3518 Call->addArg(Instr->getArg(1)); | 3518 Call->addArg(Instr->getArg(1)); |
3519 Call->addArg(Instr->getArg(2)); | 3519 Call->addArg(Instr->getArg(2)); |
3520 lowerCall(Call); | 3520 lowerCall(Call); |
3521 return; | 3521 return; |
3522 } | 3522 } |
3523 case Intrinsics::Memset: { | 3523 case Intrinsics::Memset: { |
3524 // The value operand needs to be extended to a stack slot size | 3524 // The value operand needs to be extended to a stack slot size because the |
3525 // because the PNaCl ABI requires arguments to be at least 32 bits | 3525 // PNaCl ABI requires arguments to be at least 32 bits wide. |
3526 // wide. | |
3527 Operand *ValOp = Instr->getArg(1); | 3526 Operand *ValOp = Instr->getArg(1); |
3528 assert(ValOp->getType() == IceType_i8); | 3527 assert(ValOp->getType() == IceType_i8); |
3529 Variable *ValExt = Func->template makeVariable(stackSlotType()); | 3528 Variable *ValExt = Func->template makeVariable(stackSlotType()); |
3530 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp)); | 3529 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp)); |
3531 InstCall *Call = makeHelperCall(H_call_memset, nullptr, 3); | 3530 InstCall *Call = makeHelperCall(H_call_memset, nullptr, 3); |
3532 Call->addArg(Instr->getArg(0)); | 3531 Call->addArg(Instr->getArg(0)); |
3533 Call->addArg(ValExt); | 3532 Call->addArg(ValExt); |
3534 Call->addArg(Instr->getArg(2)); | 3533 Call->addArg(Instr->getArg(2)); |
3535 lowerCall(Call); | 3534 lowerCall(Call); |
3536 return; | 3535 return; |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5250 // the flags. | 5249 // the flags. |
5251 Variable *Reg = makeReg(IceType_i32, RegNum); | 5250 Variable *Reg = makeReg(IceType_i32, RegNum); |
5252 ConstantInteger32 *Integer = llvm::cast<ConstantInteger32>(Immediate); | 5251 ConstantInteger32 *Integer = llvm::cast<ConstantInteger32>(Immediate); |
5253 uint32_t Value = Integer->getValue(); | 5252 uint32_t Value = Integer->getValue(); |
5254 uint32_t Cookie = Ctx->getRandomizationCookie(); | 5253 uint32_t Cookie = Ctx->getRandomizationCookie(); |
5255 _mov(Reg, Ctx->getConstantInt(IceType_i32, Cookie + Value)); | 5254 _mov(Reg, Ctx->getConstantInt(IceType_i32, Cookie + Value)); |
5256 Constant *Offset = Ctx->getConstantInt(IceType_i32, 0 - Cookie); | 5255 Constant *Offset = Ctx->getConstantInt(IceType_i32, 0 - Cookie); |
5257 _lea(Reg, Traits::X86OperandMem::create(Func, IceType_i32, Reg, Offset, | 5256 _lea(Reg, Traits::X86OperandMem::create(Func, IceType_i32, Reg, Offset, |
5258 nullptr, 0)); | 5257 nullptr, 0)); |
5259 // make sure liveness analysis won't kill this variable, otherwise a | 5258 // make sure liveness analysis won't kill this variable, otherwise a |
5260 // liveness | 5259 // liveness assertion will be triggered. |
5261 // assertion will be triggered. | |
5262 _set_dest_nonkillable(); | 5260 _set_dest_nonkillable(); |
5263 if (Immediate->getType() != IceType_i32) { | 5261 if (Immediate->getType() != IceType_i32) { |
5264 Variable *TruncReg = makeReg(Immediate->getType(), RegNum); | 5262 Variable *TruncReg = makeReg(Immediate->getType(), RegNum); |
5265 _mov(TruncReg, Reg); | 5263 _mov(TruncReg, Reg); |
5266 return TruncReg; | 5264 return TruncReg; |
5267 } | 5265 } |
5268 return Reg; | 5266 return Reg; |
5269 } | 5267 } |
5270 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_Pool) { | 5268 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_Pool) { |
5271 // pool the constant | 5269 // pool the constant |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5419 } | 5417 } |
5420 // the offset is not eligible for blinding or pooling, return the original | 5418 // the offset is not eligible for blinding or pooling, return the original |
5421 // mem operand | 5419 // mem operand |
5422 return MemOperand; | 5420 return MemOperand; |
5423 } | 5421 } |
5424 | 5422 |
5425 } // end of namespace X86Internal | 5423 } // end of namespace X86Internal |
5426 } // end of namespace Ice | 5424 } // end of namespace Ice |
5427 | 5425 |
5428 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 5426 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
OLD | NEW |