llvm::MachineIRBuilder::buildAtomicRMW

Build and insert OldValRes<def> = G_ATOMICRMW_<Opcode> Addr, Val, MMO.

Synopsis

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

MachineInstrBuilder
buildAtomicRMW(
    unsigned int Opcode,
    DstOp const& OldValRes,
    SrcOp const& Addr,
    SrcOp const& Val,
    MachineMemOperand& MMO);

Description

Atomically read-modify-update the value at Addr with Val. Puts the original value from Addr in OldValRes. The modification is determined by the opcode.

Return Value

a MachineInstrBuilder for the newly created instruction.

Parameters

NameDescription
OpcodeTarget opcode for the instruction.
OldValResDestination receiving the previous memory value.
AddrAddress operand.
ValValue operand.
MMOMemory operand describing the access.

Preconditions

  • setBasicBlock or setMI must have been called.
  • OldValRes must be a generic virtual register.
  • Addr must be a generic virtual register with pointer type.
  • OldValRes, and Val must be generic virtual registers of the same type.