LLVM 19.0.0git
Functions
GCRootLowering.cpp File Reference
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/MC/MCContext.h"

Go to the source code of this file.

Functions

static bool DoLowering (Function &F, GCStrategy &S)
 Lower barriers out of existence (if the associated GCStrategy hasn't already done so...), and insert initializing stores to roots as a defensive measure.
 
 INITIALIZE_PASS_BEGIN (LowerIntrinsics, "gc-lowering", "GC Lowering", false, false) FunctionPass *llvm
 
static bool CouldBecomeSafePoint (Instruction *I)
 CouldBecomeSafePoint - Predicate to conservatively determine whether the instruction could introduce a safe point.
 
static bool InsertRootInitializers (Function &F, ArrayRef< AllocaInst * > Roots)
 
 INITIALIZE_PASS (GCMachineCodeAnalysis, "gc-analysis", "Analyze Machine Code For Garbage Collection", false, false) GCMachineCodeAnalysis
 

Function Documentation

◆ CouldBecomeSafePoint()

static bool CouldBecomeSafePoint ( Instruction I)
static

CouldBecomeSafePoint - Predicate to conservatively determine whether the instruction could introduce a safe point.

Definition at line 137 of file GCRootLowering.cpp.

References F, and I.

Referenced by InsertRootInitializers().

◆ DoLowering()

bool DoLowering ( Function F,
GCStrategy S 
)
static

Lower barriers out of existence (if the associated GCStrategy hasn't already done so...), and insert initializing stores to roots as a defensive measure.

Given we're going to report all roots live at all safepoints, we need to be able to ensure each root has been initialized by the point the first safepoint is reached. This really should have been done by the frontend, but the old API made this non-obvious, so we do a potentially redundant store just in case.

Definition at line 204 of file GCRootLowering.cpp.

References llvm::Instruction::eraseFromParent(), F, llvm::CallBase::getArgOperand(), llvm::CallBase::getCalledFunction(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Value::getType(), I, InsertRootInitializers(), llvm::make_early_inc_range(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Value::replaceAllUsesWith(), llvm::SmallVectorBase< Size_T >::size(), llvm::Value::stripPointerCasts(), and llvm::Value::takeName().

Referenced by llvm::GCLoweringPass::run().

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( GCMachineCodeAnalysis  ,
"gc-analysis"  ,
"Analyze Machine Code For Garbage Collection"  ,
false  ,
false   
)

Definition at line 257 of file GCRootLowering.cpp.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( LowerIntrinsics  ,
"gc-lowering"  ,
"GC Lowering"  ,
false  ,
false   
)

Definition at line 100 of file GCRootLowering.cpp.

◆ InsertRootInitializers()

static bool InsertRootInitializers ( Function F,
ArrayRef< AllocaInst * >  Roots 
)
static