Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:43

0001 //===- LowerAtomic.h - Lower atomic intrinsics ------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 /// \file
0009 // This pass lowers atomic intrinsics to non-atomic form for use in a known
0010 // non-preemptible environment.
0011 ///
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_TRANSFORMS_UTILS_LOWERATOMIC_H
0015 #define LLVM_TRANSFORMS_UTILS_LOWERATOMIC_H
0016 
0017 #include "llvm/IR/Instructions.h"
0018 
0019 namespace llvm {
0020 
0021 class IRBuilderBase;
0022 
0023 /// Convert the given Cmpxchg into primitive load and compare.
0024 bool lowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI);
0025 
0026 /// Emit IR to implement the given cmpxchg operation on values in registers,
0027 /// returning the new value.
0028 std::pair<Value *, Value *> buildCmpXchgValue(IRBuilderBase &Builder,
0029                                               Value *Ptr, Value *Cmp,
0030                                               Value *Val, Align Alignment);
0031 
0032 /// Convert the given RMWI into primitive load and stores,
0033 /// assuming that doing so is legal. Return true if the lowering
0034 /// succeeds.
0035 bool lowerAtomicRMWInst(AtomicRMWInst *RMWI);
0036 
0037 /// Emit IR to implement the given atomicrmw operation on values in registers,
0038 /// returning the new value.
0039 Value *buildAtomicRMWValue(AtomicRMWInst::BinOp Op, IRBuilderBase &Builder,
0040                            Value *Loaded, Value *Val);
0041 }
0042 
0043 #endif // LLVM_TRANSFORMS_UTILS_LOWERATOMIC_H