LLVM  mainline
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
llvm::AtomicRMWInst Class Reference

AtomicRMWInst - an instruction that atomically reads a memory location, combines it with another value, and then stores the result back. More...

#include <Instructions.h>

Inheritance diagram for llvm::AtomicRMWInst:
Inheritance graph
[legend]
Collaboration diagram for llvm::AtomicRMWInst:
Collaboration graph
[legend]

List of all members.

Public Types

enum  BinOp {
  Xchg, Add, Sub, And,
  Nand, Or, Xor, Max,
  Min, UMax, UMin, FIRST_BINOP = Xchg,
  LAST_BINOP = UMin, BAD_BINOP
}
 This enumeration lists the possible modifications atomicrmw can make. More...

Public Member Functions

void * operator new (size_t s)
 Allocate a User with an operand pointer co-allocated.
 AtomicRMWInst (BinOp Operation, Value *Ptr, Value *Val, AtomicOrdering Ordering, SynchronizationScope SynchScope, Instruction *InsertBefore=nullptr)
 AtomicRMWInst (BinOp Operation, Value *Ptr, Value *Val, AtomicOrdering Ordering, SynchronizationScope SynchScope, BasicBlock *InsertAtEnd)
BinOp getOperation () const
void setOperation (BinOp Operation)
bool isVolatile () const
 isVolatile - Return true if this is a RMW on a volatile memory location.
void setVolatile (bool V)
 setVolatile - Specify whether this is a volatile RMW or not.
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Transparently provide more efficient getOperand methods.
void setOrdering (AtomicOrdering Ordering)
 Set the ordering constraint on this RMW.
void setSynchScope (SynchronizationScope SynchScope)
 Specify whether this RMW orders other operations with respect to all concurrently executing threads, or only with respect to signal handlers executing in the same thread.
AtomicOrdering getOrdering () const
 Returns the ordering constraint on this RMW.
SynchronizationScope getSynchScope () const
 Returns whether this RMW is atomic between threads or only within a single thread.
ValuegetPointerOperand ()
const ValuegetPointerOperand () const
ValuegetValOperand ()
const ValuegetValOperand () const
unsigned getPointerAddressSpace () const
 Returns the address space of the pointer operand.

Static Public Member Functions

static unsigned getPointerOperandIndex ()
static bool classof (const Instruction *I)
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast:

Protected Member Functions

AtomicRMWInstclone_impl () const override

Detailed Description

AtomicRMWInst - an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.

Returns the old value.

Definition at line 658 of file Instructions.h.


Member Enumeration Documentation

This enumeration lists the possible modifications atomicrmw can make.

In the descriptions, 'p' is the pointer to the instruction's memory location, 'old' is the initial value of *p, and 'v' is the other value passed to the instruction. These instructions always return 'old'.

Enumerator:
Xchg 

*p = v

Add 

*p = old + v

Sub 

*p = old - v

And 

*p = old & v

Nand 

*p = ~(old & v)

Or 

*p = old | v

Xor 

*p = old ^ v

Max 

*p = old >signed v ? old : v

Min 

*p = old <signed v ? old : v

UMax 

*p = old >unsigned v ? old : v

UMin 

*p = old <unsigned v ? old : v

FIRST_BINOP 
LAST_BINOP 
BAD_BINOP 

Definition at line 667 of file Instructions.h.


Constructor & Destructor Documentation

AtomicRMWInst::AtomicRMWInst ( BinOp  Operation,
Value Ptr,
Value Val,
AtomicOrdering  Ordering,
SynchronizationScope  SynchScope,
Instruction InsertBefore = nullptr 
)

Definition at line 1152 of file Instructions.cpp.

Referenced by clone_impl().

AtomicRMWInst::AtomicRMWInst ( BinOp  Operation,
Value Ptr,
Value Val,
AtomicOrdering  Ordering,
SynchronizationScope  SynchScope,
BasicBlock InsertAtEnd 
)

Definition at line 1163 of file Instructions.cpp.


Member Function Documentation

static bool llvm::AtomicRMWInst::classof ( const Instruction I) [inline, static]

Definition at line 773 of file Instructions.h.

References llvm::Instruction::getOpcode().

static bool llvm::AtomicRMWInst::classof ( const Value V) [inline, static]

Methods for support type inquiry through isa, cast, and dyn_cast:

Reimplemented from llvm::Instruction.

Definition at line 776 of file Instructions.h.

AtomicRMWInst * AtomicRMWInst::clone_impl ( ) const [override, protected, virtual]

Transparently provide more efficient getOperand methods.

Definition at line 707 of file Instructions.h.

Referenced by clone_impl(), and LowerAtomicRMWInst().

Returns the ordering constraint on this RMW.

Definition at line 750 of file Instructions.h.

Referenced by clone_impl(), and llvm::AliasAnalysis::getModRefInfo().

Returns the address space of the pointer operand.

Definition at line 768 of file Instructions.h.

References llvm::Type::getPointerAddressSpace(), getPointerOperand(), and llvm::Value::getType().

Definition at line 760 of file Instructions.h.

Referenced by llvm::MemoryLocation::get(), and LowerAtomicRMWInst().

Definition at line 761 of file Instructions.h.

Definition at line 762 of file Instructions.h.

Returns whether this RMW is atomic between threads or only within a single thread.

Definition at line 756 of file Instructions.h.

Referenced by clone_impl().

Definition at line 764 of file Instructions.h.

Referenced by llvm::MemoryLocation::get(), and LowerAtomicRMWInst().

Definition at line 765 of file Instructions.h.

isVolatile - Return true if this is a RMW on a volatile memory location.

Definition at line 719 of file Instructions.h.

Referenced by clone_impl().

void* llvm::AtomicRMWInst::operator new ( size_t  Size) [inline]

Allocate a User with an operand pointer co-allocated.

This is used for subclasses which need to allocate a variable number of operands, ie, 'hung off uses'.

Reimplemented from llvm::User.

Definition at line 697 of file Instructions.h.

References llvm::User::operator new().

void llvm::AtomicRMWInst::setOperation ( BinOp  Operation) [inline]

Definition at line 711 of file Instructions.h.

void llvm::AtomicRMWInst::setOrdering ( AtomicOrdering  Ordering) [inline]

Set the ordering constraint on this RMW.

Definition at line 734 of file Instructions.h.

References llvm::NotAtomic.

Specify whether this RMW orders other operations with respect to all concurrently executing threads, or only with respect to signal handlers executing in the same thread.

Definition at line 744 of file Instructions.h.

void llvm::AtomicRMWInst::setVolatile ( bool  V) [inline]

setVolatile - Specify whether this is a volatile RMW or not.

Definition at line 725 of file Instructions.h.

Referenced by clone_impl().


The documentation for this class was generated from the following files: