[Hexagon] Removing old duplicate atomic load/store patterns.
[oota-llvm.git] / include / llvm / CodeGen / GCStrategy.h
index 98c25e4a08de69555cdebf840af91a87c9bba752..bdd14463e003ba55a2ed51668f9afe78f0a86a46 100644 (file)
@@ -50,6 +50,7 @@
 #ifndef LLVM_CODEGEN_GCSTRATEGY_H
 #define LLVM_CODEGEN_GCSTRATEGY_H
 
+#include "llvm/ADT/Optional.h"
 #include "llvm/CodeGen/GCMetadata.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/Support/Registry.h"
@@ -67,12 +68,14 @@ namespace llvm {
     friend class GCModuleInfo;
     
   protected:
+    bool UseStatepoints;       /// Uses gc.statepoints as opposed to gc.roots,
+                               /// if set, none of the other options can be
+                               /// anything but their default values.
+
     unsigned NeededSafePoints; ///< Bitmask of required safe points.
     bool CustomReadBarriers;   ///< Default is to insert loads.
     bool CustomWriteBarriers;  ///< Default is to insert stores.
     bool CustomRoots;          ///< Default is to pass through to backend.
-    bool CustomSafePoints;     ///< Default is to use NeededSafePoints
-                               ///< to find safe points.
     bool InitRoots;            ///< If set, roots are nulled during lowering.
     bool UsesMetadata;         ///< If set, backend must emit metadata tables.
     
@@ -94,6 +97,22 @@ namespace llvm {
     /// them. 
     bool customReadBarrier() const { return CustomReadBarriers; }
 
+    /// Returns true if this strategy is expecting the use of gc.statepoints,
+    /// and false otherwise.
+    bool useStatepoints() const { return UseStatepoints; }
+
+    /** @name Statepoint Specific Properties */
+    ///@{
+
+    /// If the value specified can be reliably distinguished, returns true for
+    /// pointers to GC managed locations and false for pointers to non-GC 
+    /// managed locations.  Note a GCStrategy can always return 'None' (i.e. an
+    /// empty optional indicating it can't reliably distinguish.   
+    virtual Optional<bool> isGCManagedPointer(const Value *V) const {
+      return None;
+    }
+    ///@}
+
     /** @name GCRoot Specific Properties
      * These properties and overrides only apply to collector strategies using
      * GCRoot. 
@@ -103,7 +122,7 @@ namespace llvm {
     /// True if safe points of any kind are required. By default, none are
     /// recorded. 
     bool needsSafePoints() const {
-      return CustomSafePoints || NeededSafePoints != 0;
+      return NeededSafePoints != 0;
     }
     
     /// True if the given kind of safe point is required. By default, none are
@@ -116,17 +135,15 @@ namespace llvm {
     /// stack map. If true, then performCustomLowering must delete them.
     bool customRoots() const { return CustomRoots; }
 
-    /// By default, the GC analysis will find safe points according to
-    /// NeededSafePoints. If true, then findCustomSafePoints must create them.
-    bool customSafePoints() const { return CustomSafePoints; }
-    
     /// If set, gcroot intrinsics should initialize their allocas to null
     /// before the first use. This is necessary for most GCs and is enabled by
     /// default. 
     bool initializeRoots() const { return InitRoots; }
     
     /// If set, appropriate metadata tables must be emitted by the back-end
-    /// (assembler, JIT, or otherwise). 
+    /// (assembler, JIT, or otherwise). For statepoint, this method is
+    /// currently unsupported.  The stackmap information can be found in the
+    /// StackMap section as described in the documentation.
     bool usesMetadata() const { return UsesMetadata; }
 
     ///@}
@@ -147,14 +164,6 @@ namespace llvm {
       llvm_unreachable("GCStrategy subclass specified a configuration which"
                        "requires a custom lowering without providing one");
     }
-    ///@}
-    /// Called if customSafepoints returns true, used only by gc.root
-    /// implementations. 
-    virtual bool findCustomSafePoints(GCFunctionInfo& FI, MachineFunction& MF) {
-      llvm_unreachable("GCStrategy subclass specified a configuration which"
-                       "requests custom safepoint identification without"
-                       "providing an implementation for such");
-    }
   };
 
   /// Subclasses of GCStrategy are made available for use during compilation by