LLVM  6.0.0svn
Public Member Functions | Protected Attributes | Friends | List of all members
llvm::GCStrategy Class Reference

GCStrategy describes a garbage collector algorithm's code generation requirements, and provides overridable hooks for those needs which cannot be abstractly described. More...

#include "llvm/CodeGen/GCStrategy.h"

Collaboration diagram for llvm::GCStrategy:
Collaboration graph
[legend]

Public Member Functions

 GCStrategy ()
 
virtual ~GCStrategy ()=default
 
const std::string & getName () const
 Return the name of the GC strategy. More...
 
bool customWriteBarrier () const
 By default, write barriers are replaced with simple store instructions. More...
 
bool customReadBarrier () const
 By default, read barriers are replaced with simple load instructions. More...
 
bool useStatepoints () const
 Returns true if this strategy is expecting the use of gc.statepoints, and false otherwise. More...
 
Statepoint Specific Properties
virtual Optional< boolisGCManagedPointer (const Type *Ty) const
 If the type specified can be reliably distinguished, returns true for pointers to GC managed locations and false for pointers to non-GC managed locations. More...
 
GCRoot Specific Properties

These properties and overrides only apply to collector strategies using GCRoot.

bool needsSafePoints () const
 True if safe points of any kind are required. More...
 
bool needsSafePoint (GC::PointKind Kind) const
 True if the given kind of safe point is required. More...
 
bool customRoots () const
 By default, roots are left for the code generator so it can generate a stack map. More...
 
bool initializeRoots () const
 If set, gcroot intrinsics should initialize their allocas to null before the first use. More...
 
bool usesMetadata () const
 If set, appropriate metadata tables must be emitted by the back-end (assembler, JIT, or otherwise). More...
 

Protected Attributes

bool UseStatepoints = false
 
unsigned NeededSafePoints = 0
 Uses gc.statepoints as opposed to gc.roots, if set, none of the other options can be anything but their default values. More...
 
bool CustomReadBarriers = false
 Default is to insert loads. More...
 
bool CustomWriteBarriers = false
 Default is to insert stores. More...
 
bool CustomRoots = false
 Default is to pass through to backend. More...
 
bool InitRoots = true
 If set, roots are nulled during lowering. More...
 
bool UsesMetadata = false
 If set, backend must emit metadata tables. More...
 

Friends

class GCModuleInfo
 

Detailed Description

GCStrategy describes a garbage collector algorithm's code generation requirements, and provides overridable hooks for those needs which cannot be abstractly described.

GCStrategy objects must be looked up through the Function. The objects themselves are owned by the Context and must be immutable.

Definition at line 80 of file GCStrategy.h.

Constructor & Destructor Documentation

◆ GCStrategy()

GCStrategy::GCStrategy ( )
default

◆ ~GCStrategy()

virtual llvm::GCStrategy::~GCStrategy ( )
virtualdefault

Member Function Documentation

◆ customReadBarrier()

bool llvm::GCStrategy::customReadBarrier ( ) const
inline

By default, read barriers are replaced with simple load instructions.

If true, you must provide a custom pass to lower calls to .gcread.

Definition at line 114 of file GCStrategy.h.

Referenced by InsertRootInitializers(), and NeedsDefaultLoweringPass().

◆ customRoots()

bool llvm::GCStrategy::customRoots ( ) const
inline

By default, roots are left for the code generator so it can generate a stack map.

If true, you must provide a custom pass to lower calls to .gcroot.

Definition at line 151 of file GCStrategy.h.

◆ customWriteBarrier()

bool llvm::GCStrategy::customWriteBarrier ( ) const
inline

By default, write barriers are replaced with simple store instructions.

If true, you must provide a custom pass to lower calls to .gcwrite.

Definition at line 109 of file GCStrategy.h.

Referenced by InsertRootInitializers(), and NeedsDefaultLoweringPass().

◆ getName()

const std::string& llvm::GCStrategy::getName ( ) const
inline

Return the name of the GC strategy.

This is the value of the collector name string specified on functions which use this strategy.

Definition at line 104 of file GCStrategy.h.

Referenced by EmitCamlGlobal(), and llvm::AsmPrinter::isBlockOnlyReachableByFallthrough().

◆ initializeRoots()

bool llvm::GCStrategy::initializeRoots ( ) const
inline

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.

Definition at line 156 of file GCStrategy.h.

Referenced by InsertRootInitializers(), and NeedsDefaultLoweringPass().

◆ isGCManagedPointer()

virtual Optional<bool> llvm::GCStrategy::isGCManagedPointer ( const Type Ty) const
inlinevirtual

If the type 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.

Definition at line 127 of file GCStrategy.h.

References None.

Referenced by lowerStatepointMetaArgs().

◆ needsSafePoint()

bool llvm::GCStrategy::needsSafePoint ( GC::PointKind  Kind) const
inline

True if the given kind of safe point is required.

By default, none are recorded.

Definition at line 144 of file GCStrategy.h.

◆ needsSafePoints()

bool llvm::GCStrategy::needsSafePoints ( ) const
inline

True if safe points of any kind are required.

By default, none are recorded.

Definition at line 140 of file GCStrategy.h.

◆ usesMetadata()

bool llvm::GCStrategy::usesMetadata ( ) const
inline

If set, appropriate metadata tables must be emitted by the back-end (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.

Definition at line 162 of file GCStrategy.h.

Referenced by llvm::AsmPrinter::isBlockOnlyReachableByFallthrough().

◆ useStatepoints()

bool llvm::GCStrategy::useStatepoints ( ) const
inline

Returns true if this strategy is expecting the use of gc.statepoints, and false otherwise.

Definition at line 118 of file GCStrategy.h.

Referenced by llvm::AsmPrinter::isBlockOnlyReachableByFallthrough().

Friends And Related Function Documentation

◆ GCModuleInfo

friend class GCModuleInfo
friend

Definition at line 82 of file GCStrategy.h.

Member Data Documentation

◆ CustomReadBarriers

bool llvm::GCStrategy::CustomReadBarriers = false
protected

Default is to insert loads.

Definition at line 92 of file GCStrategy.h.

◆ CustomRoots

bool llvm::GCStrategy::CustomRoots = false
protected

Default is to pass through to backend.

Definition at line 94 of file GCStrategy.h.

◆ CustomWriteBarriers

bool llvm::GCStrategy::CustomWriteBarriers = false
protected

Default is to insert stores.

Definition at line 93 of file GCStrategy.h.

◆ InitRoots

bool llvm::GCStrategy::InitRoots = true
protected

If set, roots are nulled during lowering.

Definition at line 95 of file GCStrategy.h.

◆ NeededSafePoints

unsigned llvm::GCStrategy::NeededSafePoints = 0
protected

Uses gc.statepoints as opposed to gc.roots, if set, none of the other options can be anything but their default values.

Bitmask of required safe points.

Definition at line 91 of file GCStrategy.h.

◆ UsesMetadata

bool llvm::GCStrategy::UsesMetadata = false
protected

If set, backend must emit metadata tables.

Definition at line 96 of file GCStrategy.h.

◆ UseStatepoints

bool llvm::GCStrategy::UseStatepoints = false
protected

Definition at line 87 of file GCStrategy.h.


The documentation for this class was generated from the following files: