LLVM  mainline
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
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

AtomicRMWInstcloneImpl () const
 Create a copy of this instruction.

Friends

class Instruction

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 680 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 693 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 1461 of file Instructions.cpp.

Referenced by cloneImpl().

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

Definition at line 1472 of file Instructions.cpp.


Member Function Documentation

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

Definition at line 799 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 802 of file Instructions.h.

AtomicRMWInst * AtomicRMWInst::cloneImpl ( ) const [protected]

Create a copy of this instruction.

Reimplemented from llvm::Instruction.

Definition at line 3838 of file Instructions.cpp.

References AtomicRMWInst(), llvm::User::getOperand(), getOperation(), getOrdering(), getSynchScope(), isVolatile(), and setVolatile().

Transparently provide more efficient getOperand methods.

Definition at line 733 of file Instructions.h.

Referenced by cloneImpl(), llvm::expandAtomicRMWToCmpXchg(), and LowerAtomicRMWInst().

Returns the ordering constraint on this RMW.

Definition at line 776 of file Instructions.h.

Referenced by cloneImpl(), llvm::expandAtomicRMWToCmpXchg(), and llvm::AAResults::getModRefInfo().

Returns the address space of the pointer operand.

Definition at line 794 of file Instructions.h.

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

Definition at line 787 of file Instructions.h.

Definition at line 788 of file Instructions.h.

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

Definition at line 782 of file Instructions.h.

Referenced by cloneImpl().

Definition at line 791 of file Instructions.h.

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

Definition at line 745 of file Instructions.h.

Referenced by cloneImpl().

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 723 of file Instructions.h.

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

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

Definition at line 737 of file Instructions.h.

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

Set the ordering constraint on this RMW.

Definition at line 760 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 770 of file Instructions.h.

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

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

Definition at line 751 of file Instructions.h.

Referenced by cloneImpl().


Friends And Related Function Documentation

friend class Instruction [friend]

Definition at line 685 of file Instructions.h.


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