Return the difference between two pointer values, dividing out the size of the pointed‐to objects. The returned value type is the address type of the pointers.

Synopsis

Declared in <llvm/IR/IRBuilder.h>

Value*
CreatePtrDiff(
    Type* ElemTy,
    Value* LHS,
    Value* RHS,
    Twine const& Name = "");

Description

This is intended to implement C‐style pointer subtraction. As such, the pointers must be appropriately aligned for their element types and pointing into the same object.

Return Value

The difference between two pointer values, dividing out the size of the pointed‐to objects.

Parameters

Name

Description

ElemTy

Pointed‐to element type.

LHS

Left‐hand side operand.

RHS

Right‐hand side operand.

Name

Name of the new instruction or value.

Created with MrDocs