protected:
bool UseStatepoints = false; /// Uses gc.statepoints as opposed to gc.roots,
- /// if set, none of the other options can be
- /// anything but their default values.
+ /// if set, NeededSafePoints and UsesMetadata
+ /// should be left at their default values.
+
+ bool UseRS4GC = false; /// If UseStatepoints is set, this determines whether
+ /// the RewriteStatepointsForGC pass should rewrite
+ /// this function's calls.
+ /// This should only be set if UseStatepoints is set.
bool NeededSafePoints = false; ///< if set, calls are inferred to be safepoints
bool UsesMetadata = false; ///< If set, backend must emit metadata tables.
virtual std::optional<bool> isGCManagedPointer(const Type *Ty) const {
return std::nullopt;
}
+
+ /// Returns true if the RewriteStatepointsForGC pass should run on functions
+ /// using this GC.
+ bool useRS4GC() const {
+ assert(useStatepoints() &&
+ "GC strategy has useRS4GC but not useStatepoints set");
+ return UseRS4GC;
+ }
+
///@}
/// If set, appropriate metadata tables must be emitted by the back-end
public:
StatepointGC() {
UseStatepoints = true;
+ UseRS4GC = true;
// These options are all gc.root specific, we specify them so that the
// gc.root lowering code doesn't run.
NeededSafePoints = false;
public:
CoreCLRGC() {
UseStatepoints = true;
+ UseRS4GC = true;
// These options are all gc.root specific, we specify them so that the
// gc.root lowering code doesn't run.
NeededSafePoints = false;