llvm::MachineIRBuilder::buildPtrAdd

Build and insert Res = G_PTR_ADD Op0, Op1

Synopsis

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

MachineInstrBuilder
buildPtrAdd(
    DstOp const& Res,
    SrcOp const& Op0,
    SrcOp const& Op1,
    std::optional<unsigned int> Flags = std::nullopt);

Description

G_PTR_ADD adds Op1 addressible units to the pointer specified by Op0, storing the resulting pointer in Res. Addressible units are typically bytes but this can vary between targets.

Return Value

a MachineInstrBuilder for the newly created instruction.

Parameters

NameDescription
ResDestination operand for the result.
Op0First source operand.
Op1Second source operand.
FlagsOptional instruction flags to attach.

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.