Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/include/llvm/Analysis/TargetTransformInfoImpl.h
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | case Instruction::BitCast: | ||||
assert(OpTy && "Cast instructions must provide the operand type"); | assert(OpTy && "Cast instructions must provide the operand type"); | ||||
if (Ty == OpTy || (Ty->isPointerTy() && OpTy->isPointerTy())) | if (Ty == OpTy || (Ty->isPointerTy() && OpTy->isPointerTy())) | ||||
// Identity and pointer-to-pointer casts are free. | // Identity and pointer-to-pointer casts are free. | ||||
return TTI::TCC_Free; | return TTI::TCC_Free; | ||||
// Otherwise, the default basic cost is used. | // Otherwise, the default basic cost is used. | ||||
return TTI::TCC_Basic; | return TTI::TCC_Basic; | ||||
case Instruction::FDiv: | |||||
case Instruction::FRem: | |||||
case Instruction::SDiv: | |||||
case Instruction::SRem: | |||||
case Instruction::UDiv: | |||||
case Instruction::URem: | |||||
return TTI::TCC_Expensive; | |||||
case Instruction::IntToPtr: { | case Instruction::IntToPtr: { | ||||
// An inttoptr cast is free so long as the input is a legal integer type | // An inttoptr cast is free so long as the input is a legal integer type | ||||
// which doesn't contain values outside the range of a pointer. | // which doesn't contain values outside the range of a pointer. | ||||
unsigned OpSize = OpTy->getScalarSizeInBits(); | unsigned OpSize = OpTy->getScalarSizeInBits(); | ||||
if (DL.isLegalInteger(OpSize) && | if (DL.isLegalInteger(OpSize) && | ||||
OpSize <= DL.getPointerTypeSizeInBits(Ty)) | OpSize <= DL.getPointerTypeSizeInBits(Ty)) | ||||
return TTI::TCC_Free; | return TTI::TCC_Free; | ||||
▲ Show 20 Lines • Show All 416 Lines • Show Last 20 Lines |