llvm::CastInst::Create

Construct any CastInst subclass from an opcode.

Synopsis

Declared in <llvm/IR/InstrTypes.h>

static
CastInst*
Create(
    Instruction::CastOps Op,
    Value* S,
    Type* Ty,
    Twine const& Name = "",
    InsertPosition InsertBefore = nullptr);

Description

Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's constructor. The opcode must be in the CastOps category (Instruction::isCast(opcode) returns true). This constructor has insert-before-instruction semantics to automatically insert the new CastInst before InsertBefore (if it is non-null).

Return Value

The newly created cast instruction.

Parameters

NameDescription
OpThe cast opcode.
SThe value to cast (operand 0).
TyThe destination type of the cast.
NameOptional name for the instruction.
InsertBeforeOptional insertion position.