llvm::MachineIRBuilder::buildObjectPtrOffset

Build a nuw inbounds G_PTR_ADD for an in-object pointer offset.

Synopsis

Declared in <llvm/CodeGen/GlobalISel/MachineIRBuilder.h>

MachineInstrBuilder
buildObjectPtrOffset(
    DstOp const& Res,
    SrcOp const& Op0,
    SrcOp const& Op1);

Description

Builds Res = nuw inbounds G_PTR_ADD Op0, Op1. The value of Op0 must be a pointer into or just after an object; adding Op1 must yield a pointer into or just after the same object.

Return Value

a MachineInstrBuilder for the newly created instruction.

Parameters

NameDescription
ResDestination pointer.
Op0Base object pointer.
Op1Offset in addressable units.

Preconditions

  • setBasicBlock or setMI must have been called.
  • Res and Op0 must be generic virtual registers with pointer type.
  • Op1 must be a generic virtual register with scalar type.