llvm::CastInst::CreateBitOrPointerCast

Create a bitcast, pointer-to-integer, or integer-to-pointer cast.

Synopsis

Declared in <llvm/IR/InstrTypes.h>

static
CastInst*
CreateBitOrPointerCast(
    Value* S,
    Type* Ty,
    Twine const& Name = "",
    InsertPosition InsertBefore = nullptr);

Description

If the value is a pointer type and the destination an integer type, creates a PtrToInt cast. If the value is an integer type and the destination a pointer type, creates an IntToPtr cast. Otherwise, creates a bitcast.

Return Value

The newly created cast instruction.

Parameters

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