llvm/llvm/lib/CodeGen/SjLjEHPrepare.cpp

//===- SjLjEHPrepare.cpp - Eliminate Invoke & Unwind instructions ---------===//
//
// 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 transformation is designed for use by code generators which use SjLj
// based exception handling.
//
//===----------------------------------------------------------------------===//

#include "llvm/CodeGen/SjLjEHPrepare.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Utils/Local.h"
usingnamespacellvm;

#define DEBUG_TYPE

STATISTIC(NumInvokes, "Number of invokes replaced");
STATISTIC(NumSpilled, "Number of registers live across unwind edges");

namespace {
class SjLjEHPrepareImpl {};

class SjLjEHPrepare : public FunctionPass {};

} // end anonymous namespace

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

char SjLjEHPrepare::ID =;
INITIALIZE_PASS()

// Public Interface To the SjLjEHPrepare pass.
FunctionPass *llvm::createSjLjEHPreparePass(const TargetMachine *TM) {}

// doInitialization - Set up decalarations and types needed to process
// exceptions.
bool SjLjEHPrepareImpl::doInitialization(Module &M) {}

/// insertCallSiteStore - Insert a store of the call-site value to the
/// function context
void SjLjEHPrepareImpl::insertCallSiteStore(Instruction *I, int Number) {}

/// MarkBlocksLiveIn - Insert BB and all of its predecessors into LiveBBs until
/// we reach blocks we've already seen.
static void MarkBlocksLiveIn(BasicBlock *BB,
                             SmallPtrSetImpl<BasicBlock *> &LiveBBs) {}

/// substituteLPadValues - Substitute the values returned by the landingpad
/// instruction with those returned by the personality function.
void SjLjEHPrepareImpl::substituteLPadValues(LandingPadInst *LPI, Value *ExnVal,
                                             Value *SelVal) {}

/// setupFunctionContext - Allocate the function context on the stack and fill
/// it with all of the data that we know at this point.
Value *
SjLjEHPrepareImpl::setupFunctionContext(Function &F,
                                        ArrayRef<LandingPadInst *> LPads) {}

/// lowerIncomingArguments - To avoid having to handle incoming arguments
/// specially, we lower each arg to a copy instruction in the entry block. This
/// ensures that the argument value itself cannot be live out of the entry
/// block.
void SjLjEHPrepareImpl::lowerIncomingArguments(Function &F) {}

/// lowerAcrossUnwindEdges - Find all variables which are alive across an unwind
/// edge and spill them.
void SjLjEHPrepareImpl::lowerAcrossUnwindEdges(Function &F,
                                               ArrayRef<InvokeInst *> Invokes) {}

/// setupEntryBlockAndCallSites - Setup the entry block by creating and filling
/// the function context and marking the call sites with the appropriate
/// values. These values are used by the DWARF EH emitter.
bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) {}

bool SjLjEHPrepareImpl::runOnFunction(Function &F) {}