class AtomicCmpXchgInst

Declaration

class AtomicCmpXchgInst : public Instruction { /* full declaration omitted */ };

Description

An instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there. The value returned by this instruction is a pair containing the original value as first element, and an i1 indicating success (true) or failure (false) as second element.

Declared at: llvm/include/llvm/IR/Instructions.h:510

Inherits from: Instruction

Member Variables

private SyncScope::ID SSID
The synchronization scope ID of this cmpxchg instruction. Not quite enough room in SubClassData for everything, so synchronization scope ID gets its own field.

Inherited from Value:

protected SubclassOptionalData
protected NumUserOperands
protected IsUsedByMD
protected HasName
protected HasMetadata
protected HasHungOffUses
protected HasDescriptor
public static MaxAlignmentExponent = 32
public static MaximumAlignment = 1ULL << MaxAlignmentExponent

Method Overview

Inherited from Instruction:

Inherited from User:

Inherited from Value:

Methods

AtomicCmpXchgInst(
    llvm::Value* Ptr,
    llvm::Value* Cmp,
    llvm::Value* NewVal,
    llvm::Align Alignment,
    llvm::AtomicOrdering SuccessOrdering,
    llvm::AtomicOrdering FailureOrdering,
    SyncScope::ID SSID,
    llvm::Instruction* InsertBefore = nullptr)

Declared at: llvm/include/llvm/IR/Instructions.h:527

Parameters

llvm::Value* Ptr
llvm::Value* Cmp
llvm::Value* NewVal
llvm::Align Alignment
llvm::AtomicOrdering SuccessOrdering
llvm::AtomicOrdering FailureOrdering
SyncScope::ID SSID
llvm::Instruction* InsertBefore = nullptr

AtomicCmpXchgInst(
    llvm::Value* Ptr,
    llvm::Value* Cmp,
    llvm::Value* NewVal,
    llvm::Align Alignment,
    llvm::AtomicOrdering SuccessOrdering,
    llvm::AtomicOrdering FailureOrdering,
    SyncScope::ID SSID,
    llvm::BasicBlock* InsertAtEnd)

Declared at: llvm/include/llvm/IR/Instructions.h:531

Parameters

llvm::Value* Ptr
llvm::Value* Cmp
llvm::Value* NewVal
llvm::Align Alignment
llvm::AtomicOrdering SuccessOrdering
llvm::AtomicOrdering FailureOrdering
SyncScope::ID SSID
llvm::BasicBlock* InsertAtEnd

void Init(llvm::Value* Ptr,
          llvm::Value* Cmp,
          llvm::Value* NewVal,
          llvm::Align Align,
          llvm::AtomicOrdering SuccessOrdering,
          llvm::AtomicOrdering FailureOrdering,
          SyncScope::ID SSID)

Declared at: llvm/include/llvm/IR/Instructions.h:511

Parameters

llvm::Value* Ptr
llvm::Value* Cmp
llvm::Value* NewVal
llvm::Align Align
llvm::AtomicOrdering SuccessOrdering
llvm::AtomicOrdering FailureOrdering
SyncScope::ID SSID

static bool classof(const llvm::Value* V)

Declared at: llvm/include/llvm/IR/Instructions.h:682

Parameters

const llvm::Value* V

static bool classof(const llvm::Instruction* I)

Declared at: llvm/include/llvm/IR/Instructions.h:679

Parameters

const llvm::Instruction* I

llvm::AtomicCmpXchgInst* cloneImpl() const

Declared at: llvm/include/llvm/IR/Instructions.h:524

llvm::Align getAlign() const

Description

Return the alignment of the memory that is being allocated by the instruction.

Declared at: llvm/include/llvm/IR/Instructions.h:555

const llvm::Value* getCompareOperand() const

Declared at: llvm/include/llvm/IR/Instructions.h:645

llvm::Value* getCompareOperand()

Declared at: llvm/include/llvm/IR/Instructions.h:644

llvm::AtomicOrdering getFailureOrdering() const

Description

Returns the failure ordering constraint of this cmpxchg instruction.

Declared at: llvm/include/llvm/IR/Instructions.h:605

llvm::AtomicOrdering getMergedOrdering() const

Description

Returns a single ordering which is at least as strong as both the success and failure orderings for this cmpxchg.

Declared at: llvm/include/llvm/IR/Instructions.h:618

const llvm::Value* getNewValOperand() const

Declared at: llvm/include/llvm/IR/Instructions.h:648

llvm::Value* getNewValOperand()

Declared at: llvm/include/llvm/IR/Instructions.h:647

unsigned int getPointerAddressSpace() const

Description

Returns the address space of the pointer operand.

Declared at: llvm/include/llvm/IR/Instructions.h:651

llvm::Value* getPointerOperand()

Declared at: llvm/include/llvm/IR/Instructions.h:640

const llvm::Value* getPointerOperand() const

Declared at: llvm/include/llvm/IR/Instructions.h:641

static unsigned int getPointerOperandIndex()

Declared at: llvm/include/llvm/IR/Instructions.h:642

static llvm::AtomicOrdering
getStrongestFailureOrdering(
    llvm::AtomicOrdering SuccessOrdering)

Description

Returns the strongest permitted ordering on failure, given the desired ordering on success. If the comparison in a cmpxchg operation fails, there is no atomic store so release semantics cannot be provided. So this function drops explicit Release requests from the AtomicOrdering. A SequentiallyConsistent operation would remain SequentiallyConsistent.

Declared at: llvm/include/llvm/IR/Instructions.h:663

Parameters

llvm::AtomicOrdering SuccessOrdering

llvm::AtomicOrdering getSuccessOrdering() const

Description

Returns the success ordering constraint of this cmpxchg instruction.

Declared at: llvm/include/llvm/IR/Instructions.h:593

SyncScope::ID getSyncScopeID() const

Description

Returns the synchronization scope ID of this cmpxchg instruction.

Declared at: llvm/include/llvm/IR/Instructions.h:631

static bool isValidFailureOrdering(
    llvm::AtomicOrdering Ordering)

Declared at: llvm/include/llvm/IR/Instructions.h:585

Parameters

llvm::AtomicOrdering Ordering

static bool isValidSuccessOrdering(
    llvm::AtomicOrdering Ordering)

Declared at: llvm/include/llvm/IR/Instructions.h:580

Parameters

llvm::AtomicOrdering Ordering

bool isVolatile() const

Description

Return true if this is a cmpxchg from a volatile memory location.

Declared at: llvm/include/llvm/IR/Instructions.h:566

bool isWeak() const

Description

Return true if this cmpxchg may spuriously fail.

Declared at: llvm/include/llvm/IR/Instructions.h:573

void setAlignment(llvm::Align Align)

Declared at: llvm/include/llvm/IR/Instructions.h:559

Parameters

llvm::Align Align

void setFailureOrdering(
    llvm::AtomicOrdering Ordering)

Description

Sets the failure ordering constraint of this cmpxchg instruction.

Declared at: llvm/include/llvm/IR/Instructions.h:610

Parameters

llvm::AtomicOrdering Ordering

template <typename Bitfield>
void setSubclassData(
    typename Bitfield::Type Value)

Declared at: llvm/include/llvm/IR/Instructions.h:690

Templates

Bitfield

Parameters

typename Bitfield::Type Value

void setSuccessOrdering(
    llvm::AtomicOrdering Ordering)

Description

Sets the success ordering constraint of this cmpxchg instruction.

Declared at: llvm/include/llvm/IR/Instructions.h:598

Parameters

llvm::AtomicOrdering Ordering

void setSyncScopeID(SyncScope::ID SSID)

Description

Sets the synchronization scope ID of this cmpxchg instruction.

Declared at: llvm/include/llvm/IR/Instructions.h:636

Parameters

SyncScope::ID SSID

void setVolatile(bool V)

Description

Specify whether this is a volatile cmpxchg.

Declared at: llvm/include/llvm/IR/Instructions.h:570

Parameters

bool V

void setWeak(bool IsWeak)

Declared at: llvm/include/llvm/IR/Instructions.h:575

Parameters

bool IsWeak