llvm::BasicTTIImplBase::getCastInstrCost

Return the expected cost of a cast instruction.

Synopsis

Declared in <llvm/CodeGen/BasicTTIImpl.h>

InstructionCost
getCastInstrCost(
    unsigned int Opcode,
    Type* Dst,
    Type* Src,
    TTI::CastContextHint CCH,
    TTI::TargetCostKind CostKind,
    Instruction const* I = nullptr) const override;

Description

Covers bitcast, trunc, zext, and similar casts. If an existing instruction holds Opcode, it may be passed as I.

Return Value

The expected cost of a cast instruction.

Parameters

NameDescription
OpcodeCast opcode.
DstDestination type.
SrcSource type.
CCHHint about the cast context.
CostKindKind of cost to compute.
IOptional context instruction.