llvm/llvm/lib/CodeGen/GCRootLowering.cpp

//===-- GCRootLowering.cpp - Garbage collection infrastructure ------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the lowering for the gc.root mechanism.
//
//===----------------------------------------------------------------------===//

#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"

usingnamespacellvm;

/// 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.
static bool DoLowering(Function &F, GCStrategy &S);

namespace {

/// LowerIntrinsics - This pass rewrites calls to the llvm.gcread or
/// llvm.gcwrite intrinsics, replacing them with simple loads and stores as
/// directed by the GCStrategy. It also performs automatic root initialization
/// and custom intrinsic lowering.
class LowerIntrinsics : public FunctionPass {};

/// GCMachineCodeAnalysis - This is a target-independent pass over the machine
/// function representation to identify safe points for the garbage collector
/// in the machine code. It inserts labels at safe points and populates a
/// GCMetadata record for each function.
class GCMachineCodeAnalysis : public MachineFunctionPass {};
}

PreservedAnalyses GCLoweringPass::run(Function &F,
                                      FunctionAnalysisManager &FAM) {}

// -----------------------------------------------------------------------------

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

FunctionPass *llvm::createGCLoweringPass() {}

char LowerIntrinsics::ID =;
char &llvm::GCLoweringID =;

LowerIntrinsics::LowerIntrinsics() :{}

StringRef LowerIntrinsics::getPassName() const {}

void LowerIntrinsics::getAnalysisUsage(AnalysisUsage &AU) const {}

/// doInitialization - If this module uses the GC intrinsics, find them now.
bool LowerIntrinsics::doInitialization(Module &M) {}

/// CouldBecomeSafePoint - Predicate to conservatively determine whether the
/// instruction could introduce a safe point.
static bool CouldBecomeSafePoint(Instruction *I) {}

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

/// runOnFunction - Replace gcread/gcwrite intrinsics with loads and stores.
/// Leave gcroot intrinsics; the code generator needs to see those.
bool LowerIntrinsics::runOnFunction(Function &F) {}

bool DoLowering(Function &F, GCStrategy &S) {}

// -----------------------------------------------------------------------------

char GCMachineCodeAnalysis::ID =;
char &llvm::GCMachineCodeAnalysisID =;

INITIALIZE_PASS()

GCMachineCodeAnalysis::GCMachineCodeAnalysis() :{}

void GCMachineCodeAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {}

MCSymbol *GCMachineCodeAnalysis::InsertLabel(MachineBasicBlock &MBB,
                                             MachineBasicBlock::iterator MI,
                                             const DebugLoc &DL) const {}

void GCMachineCodeAnalysis::VisitCallPoint(MachineBasicBlock::iterator CI) {}

void GCMachineCodeAnalysis::FindSafePoints(MachineFunction &MF) {}

void GCMachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) {}

bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {}