[PATCH] Add hooks for emitLeading/TrailingFence in TargetLowering

Robin Morisset morisset at google.com
Mon Aug 18 15:07:04 PDT 2014


Hi jfb,

These hooks will be used in a later patch by AtomicExpandPass.
They will replace the current "target-independent"
AtomicExpandLoadLinkedPass::insertLeading/TrailingFence which are incorrect, but happen
to work on ARM where they are used.

http://reviews.llvm.org/D4959

Files:
  include/llvm/Target/TargetLowering.h

Index: include/llvm/Target/TargetLowering.h
===================================================================
--- include/llvm/Target/TargetLowering.h
+++ include/llvm/Target/TargetLowering.h
@@ -956,6 +956,24 @@
     llvm_unreachable("Store conditional unimplemented on this target");
   }
 
+  /// Inserts in the IR a target-specific intrinsic specifying a fence.
+  /// It is called by AtomicExpandPass before expanding an
+  ///   AtomicRMW/AtomicCmpXchg/AtomicStore/AtomicLoad.
+  /// RMW and CAS set both IsStore and IsLoad to true.
+  /// Backends without insertFencesForAtomic() should have a no-op here
+  virtual void emitLeadingFence(IRBuilder<> &Builder, AtomicOrdering Ord,
+          bool IsStore, bool IsLoad) const {
+  }
+
+  /// Inserts in the IR a target-specific intrinsic specifying a fence.
+  /// It is called by AtomicExpandPass after expanding an
+  ///   AtomicRMW/AtomicCmpXchg/AtomicStore/AtomicLoad.
+  /// RMW and CAS set both IsStore and IsLoad to true.
+  /// Backends without insertFencesForAtomic() should have a no-op here
+  virtual void emitTrailingFence(IRBuilder<> &Builder, AtomicOrdering Ord,
+          bool IsStore, bool IsLoad) const {
+  }
+
   /// Return true if the given (atomic) instruction should be expanded by the
   /// IR-level AtomicExpand pass into a loop involving
   /// load-linked/store-conditional pairs. Atomic stores will be expanded in the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4959.12629.patch
Type: text/x-patch
Size: 1406 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140818/90b4accf/attachment.bin>


More information about the llvm-commits mailing list