[llvm] 506875c - [TargetLowering] Move methods out of line (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 6 07:06:44 PDT 2021


Author: Nikita Popov
Date: 2021-06-06T16:02:10+02:00
New Revision: 506875c87926b8009664ffc15a1f8233e8460cde

URL: https://github.com/llvm/llvm-project/commit/506875c87926b8009664ffc15a1f8233e8460cde
DIFF: https://github.com/llvm/llvm-project/commit/506875c87926b8009664ffc15a1f8233e8460cde.diff

LOG: [TargetLowering] Move methods out of line (NFC)

Move methods using IRBuilder out of line, so we can drop the
dependency on the header.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/TargetLowering.h
    llvm/lib/CodeGen/TargetLoweringBase.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index d311e8f4c31e2..f93415f2ccae3 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -1945,21 +1945,11 @@ class TargetLoweringBase {
   ///  IR-level fences can prevent it.
   /// @{
   virtual Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
-                                        AtomicOrdering Ord) const {
-    if (isReleaseOrStronger(Ord) && Inst->hasAtomicStore())
-      return Builder.CreateFence(Ord);
-    else
-      return nullptr;
-  }
+                                        AtomicOrdering Ord) const;
 
   virtual Instruction *emitTrailingFence(IRBuilder<> &Builder,
                                          Instruction *Inst,
-                                         AtomicOrdering Ord) const {
-    if (isAcquireOrStronger(Ord))
-      return Builder.CreateFence(Ord);
-    else
-      return nullptr;
-  }
+                                         AtomicOrdering Ord) const;
   /// @}
 
   // Emits code that executes when the comparison result in the ll/sc

diff  --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 4f91a84983fc2..f42072a8d2c0d 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -2254,6 +2254,24 @@ TargetLoweringBase::getAtomicMemOperandFlags(const Instruction &AI,
   return Flags;
 }
 
+Instruction *TargetLoweringBase::emitLeadingFence(IRBuilder<> &Builder,
+                                                  Instruction *Inst,
+                                                  AtomicOrdering Ord) const {
+  if (isReleaseOrStronger(Ord) && Inst->hasAtomicStore())
+    return Builder.CreateFence(Ord);
+  else
+    return nullptr;
+}
+
+Instruction *TargetLoweringBase::emitTrailingFence(IRBuilder<> &Builder,
+                                                   Instruction *Inst,
+                                                   AtomicOrdering Ord) const {
+  if (isAcquireOrStronger(Ord))
+    return Builder.CreateFence(Ord);
+  else
+    return nullptr;
+}
+
 //===----------------------------------------------------------------------===//
 //  GlobalISel Hooks
 //===----------------------------------------------------------------------===//


        


More information about the llvm-commits mailing list