|
LLVM
3.7.0
|
#include "llvm/Pass.h"#include "llvm/Analysis/CFG.h"#include "llvm/Analysis/TargetTransformInfo.h"#include "llvm/ADT/SetOperations.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/SetVector.h"#include "llvm/ADT/StringRef.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/CallSite.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/Function.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InstIterator.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/Module.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/Statepoint.h"#include "llvm/IR/Value.h"#include "llvm/IR/Verifier.h"#include "llvm/Support/Debug.h"#include "llvm/Support/CommandLine.h"#include "llvm/Transforms/Scalar.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/Cloning.h"#include "llvm/Transforms/Utils/Local.h"#include "llvm/Transforms/Utils/PromoteMemToReg.h"Go to the source code of this file.
Classes | |
| struct | false::GCPtrLivenessData |
| struct | false::PartiallyConstructedSafepointRecord |
Namespaces | |
| false | |
Macros | |
| #define | DEBUG_TYPE "rewrite-statepoints-for-gc" |
Typedefs | |
| typedef DenseMap< Value *, Value * > | false::DefiningValueMapTy |
| typedef DenseSet< llvm::Value * > | false::StatepointLiveSetTy |
| typedef DenseMap< Instruction *, Value * > | false::RematerializedValueMapTy |
Functions | |
| INITIALIZE_PASS_BEGIN (RewriteStatepointsForGC,"rewrite-statepoints-for-gc","Make relocations explicit at statepoints", false, false) INITIALIZE_PASS_END(RewriteStatepointsForGC | |
| static void | computeLiveInValues (DominatorTree &DT, Function &F, GCPtrLivenessData &Data) |
| Compute the live-in set for every basic block in the function. More... | |
| static void | findLiveSetAtInst (Instruction *inst, GCPtrLivenessData &Data, StatepointLiveSetTy &out) |
| Given results from the dataflow liveness computation, find the set of live Values at a particular instruction. More... | |
| static bool | isGCPointerType (const Type *T) |
| static bool | isHandledGCPointerType (Type *T) |
| static bool | containsGCPtrType (Type *Ty) |
| Returns true if this type contains a gc pointer whether we know how to handle that type or not. More... | |
| static bool | isUnhandledGCPointerType (Type *Ty) |
| static bool | order_by_name (llvm::Value *a, llvm::Value *b) |
| static void | analyzeParsePointLiveness (DominatorTree &DT, GCPtrLivenessData &OriginalLivenessData, const CallSite &CS, PartiallyConstructedSafepointRecord &result) |
| static Value * | findBaseDefiningValue (Value *I) |
| Helper function for findBasePointer - Will return a value which either a) defines the base pointer for the input or b) blocks the simple search (i.e. More... | |
| static std::pair< Value *, bool > | findBaseDefiningValueOfVector (Value *I, Value *Index=nullptr) |
| Return a base defining value for the 'Index' element of the given vector instruction 'I'. More... | |
| static bool | isKnownBaseResult (Value *V) |
| Given the result of a call to findBaseDefiningValue, or findBaseOrBDV, is it known to be a base pointer? Or do we need to continue searching. More... | |
| static Value * | findBaseDefiningValueCached (Value *I, DefiningValueMapTy &Cache) |
| Returns the base defining value for this value. More... | |
| static Value * | findBaseOrBDV (Value *I, DefiningValueMapTy &Cache) |
| Return a base pointer for this value if known. More... | |
| static Value * | findBasePointer (Value *I, DefiningValueMapTy &cache) |
| For a given value or instruction, figure out what base ptr it's derived from. More... | |
| static void | findBasePointers (const StatepointLiveSetTy &live, DenseMap< llvm::Value *, llvm::Value * > &PointerToBase, DominatorTree *DT, DefiningValueMapTy &DVCache) |
| static void | findBasePointers (DominatorTree &DT, DefiningValueMapTy &DVCache, const CallSite &CS, PartiallyConstructedSafepointRecord &result) |
| Find the required based pointers (and adjust the live set) for the given parse point. More... | |
| static void | recomputeLiveInValues (GCPtrLivenessData &RevisedLivenessData, const CallSite &CS, PartiallyConstructedSafepointRecord &result) |
| Given an updated version of the dataflow liveness results, update the liveset and base pointer maps for the call site CS. More... | |
| static void | recomputeLiveInValues (Function &F, DominatorTree &DT, Pass *P, ArrayRef< CallSite > toUpdate, MutableArrayRef< struct PartiallyConstructedSafepointRecord > records) |
| static BasicBlock * | normalizeForInvokeSafepoint (BasicBlock *BB, BasicBlock *InvokeParent, DominatorTree &DT) |
| static int | find_index (ArrayRef< Value * > livevec, Value *val) |
| static AttributeSet | legalizeCallAttributes (AttributeSet AS) |
| static void | CreateGCRelocates (ArrayRef< llvm::Value * > LiveVariables, const int LiveStart, ArrayRef< llvm::Value * > BasePtrs, Instruction *StatepointToken, IRBuilder<> Builder) |
| Helper function to place all gc relocates necessary for the given statepoint. More... | |
| static void | makeStatepointExplicitImpl (const CallSite &CS, const SmallVectorImpl< llvm::Value * > &basePtrs, const SmallVectorImpl< llvm::Value * > &liveVariables, Pass *P, PartiallyConstructedSafepointRecord &result) |
| static void | stablize_order (SmallVectorImpl< Value * > &basevec, SmallVectorImpl< Value * > &livevec) |
| static void | makeStatepointExplicit (DominatorTree &DT, const CallSite &CS, Pass *P, PartiallyConstructedSafepointRecord &result) |
| static void | insertRelocationStores (iterator_range< Value::user_iterator > GCRelocs, DenseMap< Value *, Value * > &AllocaMap, DenseSet< Value * > &VisitedLiveValues) |
| static void | insertRematerializationStores (RematerializedValueMapTy RematerializedValues, DenseMap< Value *, Value * > &AllocaMap, DenseSet< Value * > &VisitedLiveValues) |
| static void | relocationViaAlloca (Function &F, DominatorTree &DT, ArrayRef< Value * > Live, ArrayRef< struct PartiallyConstructedSafepointRecord > Records) |
| do all the relocation update via allocas and mem2reg More... | |
| template<typename T > | |
| static void | unique_unsorted (SmallVectorImpl< T > &Vec) |
| Implement a unique function which doesn't require we sort the input vector. More... | |
| static void | insertUseHolderAfter (CallSite &CS, const ArrayRef< Value * > Values, SmallVectorImpl< CallInst * > &Holders) |
| Insert holders so that each Value is obviously live through the entire lifetime of the call. More... | |
| static void | findLiveReferences (Function &F, DominatorTree &DT, Pass *P, ArrayRef< CallSite > toUpdate, MutableArrayRef< struct PartiallyConstructedSafepointRecord > records) |
| static void | splitVectorValues (Instruction *StatepointInst, StatepointLiveSetTy &LiveSet, DenseMap< Value *, Value * > &PointerToBase, DominatorTree &DT) |
| Remove any vector of pointers from the liveset by scalarizing them over the statepoint instruction. More... | |
| static bool | findRematerializableChainToBasePointer (SmallVectorImpl< Instruction * > &ChainToBase, Value *CurrentValue, Value *BaseValue) |
| static unsigned | chainToBasePointerCost (SmallVectorImpl< Instruction * > &Chain, TargetTransformInfo &TTI) |
| static void | rematerializeLiveValues (CallSite CS, PartiallyConstructedSafepointRecord &Info, TargetTransformInfo &TTI) |
| static bool | insertParsePoints (Function &F, DominatorTree &DT, Pass *P, SmallVectorImpl< CallSite > &toUpdate) |
| template<typename AttrHolder > | |
| static void | RemoveDerefAttrAtIndex (LLVMContext &Ctx, AttrHolder &AH, unsigned Index) |
| static bool | shouldRewriteStatepointsIn (Function &F) |
| Returns true if this function should be rewritten by this pass. More... | |
| static void | computeLiveInValues (BasicBlock::reverse_iterator rbegin, BasicBlock::reverse_iterator rend, DenseSet< Value * > &LiveTmp) |
| Compute the live-in set for the location rbegin starting from the live-out set of the basic block. More... | |
| static void | computeLiveOutSeed (BasicBlock *BB, DenseSet< Value * > &LiveTmp) |
| static DenseSet< Value * > | computeKillSet (BasicBlock *BB) |
| static void | checkBasicSSA (DominatorTree &DT, DenseSet< Value * > &Live, TerminatorInst *TI, bool TermOkay=false) |
| Check that the items in 'Live' dominate 'TI'. More... | |
| static void | checkBasicSSA (DominatorTree &DT, GCPtrLivenessData &Data, BasicBlock &BB) |
| Check that all the liveness sets used during the computation of liveness obey basic SSA properties. More... | |
Variables | |
| static cl::opt< bool > | TraceLSP ("trace-rewrite-statepoints", cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | PrintLiveSet ("spp-print-liveset", cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | PrintLiveSetSize ("spp-print-liveset-size", cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | PrintBasePointers ("spp-print-base-pointers", cl::Hidden, cl::init(false)) |
| static cl::opt< unsigned > | RematerializationThreshold ("spp-rematerialization-threshold", cl::Hidden, cl::init(6)) |
| static bool | ClobberNonLive = false |
| static cl::opt< bool, true > | ClobberNonLiveOverride ("rs4gc-clobber-non-live", cl::location(ClobberNonLive), cl::Hidden) |
| rewrite statepoints for | gc |
| rewrite statepoints for Make relocations at | statepoints |
| rewrite statepoints for Make relocations at | false |
| #define DEBUG_TYPE "rewrite-statepoints-for-gc" |
Definition at line 45 of file RewriteStatepointsForGC.cpp.
|
static |
Definition at line 267 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::errs(), findLiveSetAtInst(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::Value::getName(), llvm::SmallVectorImpl< T >::insert(), order_by_name(), PrintLiveSet, and PrintLiveSetSize.
Referenced by findLiveReferences().
|
static |
Definition at line 1929 of file RewriteStatepointsForGC.cpp.
References GEP, llvm::TargetTransformInfo::getAddressComputationCost(), llvm::TargetTransformInfo::getCastInstrCost(), and llvm_unreachable.
Referenced by rematerializeLiveValues().
|
static |
Check that the items in 'Live' dominate 'TI'.
This is used as a basic sanity check for the liveness computation.
Definition at line 2506 of file RewriteStatepointsForGC.cpp.
References llvm::DominatorTree::dominates(), and I.
Referenced by checkBasicSSA(), and computeLiveInValues().
|
static |
Check that all the liveness sets used during the computation of liveness obey basic SSA properties.
This is useful for finding cases where we miss a def.
Definition at line 2524 of file RewriteStatepointsForGC.cpp.
References checkBasicSSA(), and llvm::BasicBlock::getTerminator().
|
static |
Definition at line 2495 of file RewriteStatepointsForGC.cpp.
References I, llvm::DenseSet< ValueT, ValueInfoT >::insert(), and isHandledGCPointerType().
Referenced by computeLiveInValues().
|
static |
Compute the live-in set for every basic block in the function.
Definition at line 2532 of file RewriteStatepointsForGC.cpp.
References llvm::SetVector< T, SmallVector< T, N >, SmallSet< T, N > >::back(), checkBasicSSA(), computeKillSet(), computeLiveOutSeed(), llvm::SetVector< T, SmallVector< T, N >, SmallSet< T, N > >::empty(), llvm::SetVector< T, SmallVector< T, N >, SmallSet< T, N > >::insert(), llvm::RegState::Kill, llvm::SetVector< T, SmallVector< T, N >, SmallSet< T, N > >::pop_back(), llvm::pred_begin(), llvm::pred_end(), llvm::set_subtract(), llvm::set_union(), llvm::DenseSet< ValueT, ValueInfoT >::size(), and llvm::successors().
Referenced by findLiveReferences(), findLiveSetAtInst(), and recomputeLiveInValues().
|
static |
Compute the live-in set for the location rbegin starting from the live-out set of the basic block.
Definition at line 2443 of file RewriteStatepointsForGC.cpp.
References llvm::DenseSet< ValueT, ValueInfoT >::erase(), llvm::Value::getType(), I, llvm::DenseSet< ValueT, ValueInfoT >::insert(), isHandledGCPointerType(), isUnhandledGCPointerType(), llvm::User::operands(), and llvm::sys::path::rend().
|
static |
Definition at line 2479 of file RewriteStatepointsForGC.cpp.
References llvm::PHINode::getIncomingValueForBlock(), I, llvm::DenseSet< ValueT, ValueInfoT >::insert(), isHandledGCPointerType(), isUnhandledGCPointerType(), and llvm::successors().
Referenced by computeLiveInValues().
Returns true if this type contains a gc pointer whether we know how to handle that type or not.
Definition at line 228 of file RewriteStatepointsForGC.cpp.
References isGCPointerType(), and llvm::AArch64DB::ST.
Referenced by isUnhandledGCPointerType().
|
static |
Helper function to place all gc relocates necessary for the given statepoint.
Inputs: liveVariables - list of variables to be relocated. liveStart - index of the first live variable. basePtrs - base pointers. statepointToken - statepoint instruction to which relocates should be bound. Builder - Llvm IR builder to be used to construct new calls.
Definition at line 1176 of file RewriteStatepointsForGC.cpp.
References llvm::CallingConv::Cold, llvm::IRBuilder< preserveNames, T, Inserter >::CreateCall(), find_index(), llvm::ConstantInt::get(), llvm::Module::getContext(), llvm::Intrinsic::getDeclaration(), llvm::Type::getInt32Ty(), llvm::Type::getInt8PtrTy(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::SmallVectorTemplateCommon< T >::size(), and llvm::ArrayRef< T >::size().
Referenced by makeStatepointExplicitImpl().
Definition at line 1126 of file RewriteStatepointsForGC.cpp.
References llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), and llvm::ArrayRef< T >::size().
Referenced by CreateGCRelocates().
Helper function for findBasePointer - Will return a value which either a) defines the base pointer for the input or b) blocks the simple search (i.e.
a PHI or Select of two derived pointers)
Definition at line 382 of file RewriteStatepointsForGC.cpp.
References llvm::tgtok::Def, findBaseDefiningValueOfVector(), GEP, llvm::Value::getType(), I, llvm::Type::isPointerTy(), llvm::Type::isVectorTy(), and llvm_unreachable.
Referenced by findBaseDefiningValueCached(), and findBaseDefiningValueOfVector().
Returns the base defining value for this value.
Definition at line 545 of file RewriteStatepointsForGC.cpp.
References llvm::dbgs(), findBaseDefiningValue(), llvm::Value::getName(), I, and TraceLSP.
Referenced by findBaseOrBDV().
|
static |
Return a base defining value for the 'Index' element of the given vector instruction 'I'.
If Index is null, returns a BDV for the entire vector 'I'. As an optimization, this method will try to determine when the element is known to already be a base pointer. If this can be established, the second value in the returned pair will be true. Note that either a vector or a pointer typed value can be returned. For the former, the vector returned is a BDV (and possibly a base) of the entire vector 'I'. If the later, the return pointer is a BDV (or possibly a base) for the particular element in 'I'.
Definition at line 307 of file RewriteStatepointsForGC.cpp.
References findBaseDefiningValue(), llvm::Value::getType(), and llvm::Type::isVectorTy().
Referenced by findBaseDefiningValue().
Return a base pointer for this value if known.
Otherwise, return it's base defining value.
Definition at line 561 of file RewriteStatepointsForGC.cpp.
References llvm::tgtok::Def, findBaseDefiningValueCached(), and Found().
Referenced by findBasePointer().
For a given value or instruction, figure out what base ptr it's derived from.
For gc objects, this is simply itself. On success, returns a value which is the base pointer. (This is reliable and can be used for relocation.) On failure, returns nullptr.
Definition at line 700 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SelectInst::Create(), llvm::PHINode::Create(), llvm::Value::dump(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::errs(), findBaseOrBDV(), llvm::ConstantInt::get(), llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::UndefValue::get(), llvm::SelectInst::getCondition(), llvm::Module::getContext(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::Type::getInt32Ty(), llvm::Value::getName(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::Value::hasName(), isKnownBaseResult(), order_by_name(), llvm::pred_begin(), llvm::pred_end(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::Instruction::setMetadata(), llvm::User::setOperand(), states, llvm::Value::stripPointerCasts(), and TraceLSP.
Referenced by findBasePointers().
|
static |
Definition at line 1026 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::DominatorTree::dominates(), llvm::SmallVectorTemplateCommon< T >::end(), findBasePointer(), getParent(), llvm::SmallVectorImpl< T >::insert(), and order_by_name().
Referenced by findBasePointers(), and insertParsePoints().
|
static |
Find the required based pointers (and adjust the live set) for the given parse point.
Definition at line 1056 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::errs(), findBasePointers(), llvm::Value::getName(), order_by_name(), PrintBasePointers, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorImpl< T >::reserve(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size().
|
static |
Definition at line 1742 of file RewriteStatepointsForGC.cpp.
References analyzeParsePointLiveness(), computeLiveInValues(), llvm::CS, info, and llvm::ArrayRef< T >::size().
Referenced by insertParsePoints().
|
static |
Given results from the dataflow liveness computation, find the set of live Values at a particular instruction.
Definition at line 2610 of file RewriteStatepointsForGC.cpp.
References computeLiveInValues(), llvm::Instruction::getParent(), llvm::BasicBlock::rbegin(), and llvm::sys::path::rend().
Referenced by analyzeParsePointLiveness(), and recomputeLiveInValues().
|
static |
Definition at line 1893 of file RewriteStatepointsForGC.cpp.
References llvm::tgtok::Def, GEP, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by rematerializeLiveValues().
| INITIALIZE_PASS_BEGIN | ( | RewriteStatepointsForGC | , |
| "rewrite-statepoints-for-gc" | , | ||
| "Make relocations explicit at statepoints" | , | ||
| false | , | ||
| false | |||
| ) |
|
static |
Definition at line 2082 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::CS, llvm::DominatorTree::dominates(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::errs(), F(), findBasePointers(), findLiveReferences(), llvm::StatepointBase< FunTy, InstructionTy, ValueTy, CallSiteTy >::gc_args(), llvm::StatepointBase< FunTy, InstructionTy, ValueTy, CallSiteTy >::gc_args_begin(), llvm::StatepointBase< FunTy, InstructionTy, ValueTy, CallSiteTy >::gc_args_end(), llvm::Pass::getAnalysis(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::InvokeInst::getNormalDest(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::Value::getType(), llvm::InvokeInst::getUnwindDest(), info, llvm::SmallVectorImpl< T >::insert(), insertUseHolderAfter(), isGCPointerType(), isHandledGCPointerType(), llvm::DominatorTree::isReachableFromEntry(), llvm::isStatepoint(), isUnhandledGCPointerType(), makeStatepointExplicit(), normalizeForInvokeSafepoint(), PrintBasePointers, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), recomputeLiveInValues(), relocationViaAlloca(), rematerializeLiveValues(), llvm::SmallVectorImpl< T >::reserve(), llvm::SmallVectorTemplateCommon< T >::size(), splitVectorValues(), unique_unsorted(), and llvm::StatepointBase< FunTy, InstructionTy, ValueTy, CallSiteTy >::vm_state_args().
|
static |
Definition at line 1439 of file RewriteStatepointsForGC.cpp.
References llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::GCRelocateOperands::getDerivedPtr(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Value::getName(), llvm::ilist_node< NodeTy >::getNextNode(), llvm::Value::hasName(), llvm::DenseSet< ValueT, ValueInfoT >::insert(), llvm::Instruction::insertAfter(), and llvm::SPII::Store.
Referenced by relocationViaAlloca().
|
static |
Definition at line 1482 of file RewriteStatepointsForGC.cpp.
References llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::DenseSet< ValueT, ValueInfoT >::insert(), llvm::Instruction::insertAfter(), and llvm::SPII::Store.
Referenced by relocationViaAlloca().
|
static |
Insert holders so that each Value is obviously live through the entire lifetime of the call.
Definition at line 1716 of file RewriteStatepointsForGC.cpp.
References llvm::CallInst::Create(), llvm::ArrayRef< T >::empty(), llvm::FunctionType::get(), llvm::Module::getContext(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::Module::getOrInsertFunction(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Type::getVoidTy(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isCall(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by insertParsePoints().
Definition at line 200 of file RewriteStatepointsForGC.cpp.
Referenced by containsGCPtrType(), insertParsePoints(), and isHandledGCPointerType().
Definition at line 213 of file RewriteStatepointsForGC.cpp.
References isGCPointerType().
Referenced by computeKillSet(), computeLiveInValues(), computeLiveOutSeed(), insertParsePoints(), and isUnhandledGCPointerType().
Given the result of a call to findBaseDefiningValue, or findBaseOrBDV, is it known to be a base pointer? Or do we need to continue searching.
Definition at line 574 of file RewriteStatepointsForGC.cpp.
Referenced by findBasePointer().
Definition at line 245 of file RewriteStatepointsForGC.cpp.
References containsGCPtrType(), and isHandledGCPointerType().
Referenced by computeLiveInValues(), computeLiveOutSeed(), and insertParsePoints().
|
static |
Definition at line 1136 of file RewriteStatepointsForGC.cpp.
References llvm::AttributeSet::addAttributes(), llvm::AttributeSet::begin(), llvm::AttributeSet::end(), llvm::AttributeSet::FunctionIndex, llvm::AttributeSet::getContext(), llvm::AttributeSet::getNumSlots(), llvm::AttributeSet::getSlotIndex(), llvm::Attribute::hasAttribute(), llvm::Attribute::ReadNone, llvm::Attribute::ReadOnly, llvm::AttributeSet::ReturnIndex, and llvm::Slot.
Referenced by makeStatepointExplicitImpl().
|
static |
Definition at line 1404 of file RewriteStatepointsForGC.cpp.
References llvm::Instruction::eraseFromParent(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), makeStatepointExplicitImpl(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::SmallVectorTemplateCommon< T >::size(), and stablize_order().
Referenced by insertParsePoints().
|
static |
Definition at line 1223 of file RewriteStatepointsForGC.cpp.
References llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_begin(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_end(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::BasicBlock::begin(), llvm::InvokeInst::Create(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateCall(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateExtractValue(), CreateGCRelocates(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::BasicBlock::end(), F(), llvm::CallInst::getAttributes(), llvm::InvokeInst::getAttributes(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallInst::getCallingConv(), llvm::InvokeInst::getCallingConv(), llvm::Instruction::getDebugLoc(), llvm::BasicBlock::getFirstInsertionPt(), llvm::AttributeSet::getFnAttributes(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::BasicBlock::getLandingPadInst(), llvm::InvokeInst::getNormalDest(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::AttributeSet::getRetAttributes(), llvm::BasicBlock::getUniquePredecessor(), llvm::InvokeInst::getUnwindDest(), llvm::Value::hasNUses(), llvm::Value::hasOneUse(), llvm::SmallVectorImpl< T >::insert(), llvm::IP, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isCall(), llvm::isGCResult(), llvm::isStatepoint(), llvm::CallInst::isTailCall(), legalizeCallAttributes(), llvm::Value::replaceAllUsesWith(), llvm::InvokeInst::setCallingConv(), llvm::IRBuilderBase::SetCurrentDebugLocation(), llvm::IRBuilderBase::SetInsertPoint(), llvm::CallInst::setTailCall(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::Value::takeName(), and llvm::Value::user_begin().
Referenced by makeStatepointExplicit().
|
static |
Definition at line 1109 of file RewriteStatepointsForGC.cpp.
References llvm::BasicBlock::begin(), llvm::FoldSingleEntryPHINodes(), llvm::BasicBlock::getUniquePredecessor(), llvm::MipsISD::Ret, and llvm::SplitBlockPredecessors().
Referenced by insertParsePoints().
|
static |
Definition at line 250 of file RewriteStatepointsForGC.cpp.
References llvm::StringRef::compare(), llvm::Value::getName(), and llvm::Value::hasName().
Referenced by analyzeParsePointLiveness(), findBasePointer(), and findBasePointers().
|
static |
Given an updated version of the dataflow liveness results, update the liveset and base pointer maps for the call site CS.
Definition at line 2629 of file RewriteStatepointsForGC.cpp.
References llvm::DenseSet< ValueT, ValueInfoT >::count(), findLiveSetAtInst(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), and llvm::DenseSet< ValueT, ValueInfoT >::insert().
Referenced by insertParsePoints(), and recomputeLiveInValues().
|
static |
Definition at line 1088 of file RewriteStatepointsForGC.cpp.
References computeLiveInValues(), llvm::CS, info, recomputeLiveInValues(), and llvm::ArrayRef< T >::size().
|
static |
do all the relocation update via allocas and mem2reg
Definition at line 1505 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::BasicBlock::begin(), ClobberNonLive, llvm::DenseSet< ValueT, ValueInfoT >::count(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::tgtok::Def, llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::BasicBlock::end(), llvm::SmallVectorImpl< T >::erase(), llvm::ConstantPointerNull::get(), llvm::Function::getEntryBlock(), llvm::BasicBlock::getFirstNonPHI(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::BasicBlock::getTerminator(), I, llvm::Instruction::insertAfter(), llvm::Instruction::insertBefore(), insertRelocationStores(), insertRematerializationStores(), llvm::IP, llvm::SPII::Load, llvm::PromoteMemToReg(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::PHINode::setIncomingValue(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::ArrayRef< T >::size(), llvm::SPII::Store, llvm::Value::user_begin(), llvm::Value::user_end(), and llvm::Value::users().
Referenced by insertParsePoints().
|
static |
Definition at line 1964 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), chainToBasePointerCost(), llvm::Instruction::clone(), llvm::SmallVectorTemplateCommon< T >::end(), findRematerializableChainToBasePointer(), llvm::BasicBlock::getFirstInsertionPt(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::ilist_node< NodeTy >::getNextNode(), llvm::InvokeInst::getNormalDest(), llvm::InvokeInst::getUnwindDest(), llvm::Instruction::insertBefore(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isCall(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isInvoke(), llvm::User::operand_values(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), RematerializationThreshold, llvm::User::replaceUsesOfWith(), llvm::Value::setName(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by insertParsePoints().
|
static |
Definition at line 2290 of file RewriteStatepointsForGC.cpp.
References llvm::AttrBuilder::addAttribute(), llvm::Attribute::Dereferenceable, llvm::Attribute::DereferenceableOrNull, llvm::AttrBuilder::empty(), and llvm::Attribute::get().
Returns true if this function should be rewritten by this pass.
The main point of this function is as an extension point for custom logic.
Definition at line 2356 of file RewriteStatepointsForGC.cpp.
References llvm::Function::getGC(), and llvm::Function::hasGC().
|
static |
Remove any vector of pointers from the liveset by scalarizing them over the statepoint instruction.
Adds the scalarized pieces to the liveset. It would be preferrable to include the vector in the statepoint itself, but the lowering code currently does not handle that. Extending it would be slightly non-trivial since it requires a format change. Given how rare such cases are (for the moment?) scalarizing is an acceptable comprimise.
Definition at line 1760 of file RewriteStatepointsForGC.cpp.
References llvm::BasicBlock::begin(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::SmallVectorBase::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::erase(), F(), llvm::UndefValue::get(), llvm::Function::getEntryBlock(), llvm::BasicBlock::getFirstInsertionPt(), llvm::BasicBlock::getFirstNonPHI(), llvm::InvokeInst::getNormalDest(), llvm::VectorType::getNumElements(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::Value::getType(), llvm::InvokeInst::getUnwindDest(), I, llvm::Instruction::insertAfter(), llvm::IP, llvm::SPII::Load, llvm::PromoteMemToReg(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SPII::Store, Users, and llvm::Value::users().
Referenced by insertParsePoints().
|
static |
Definition at line 1380 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by makeStatepointExplicit().
|
static |
Implement a unique function which doesn't require we sort the input vector.
Doing so has the effect of changing the output of a couple of tests in ways which make them less useful in testing fused safepoints.
Definition at line 1707 of file RewriteStatepointsForGC.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), and llvm::SmallSet< T, N, C >::insert().
Referenced by insertParsePoints().
Definition at line 71 of file RewriteStatepointsForGC.cpp.
Referenced by relocationViaAlloca().
|
static |
|
explicit |
Definition at line 132 of file RewriteStatepointsForGC.cpp.
| rewrite statepoints for gc |
Definition at line 132 of file RewriteStatepointsForGC.cpp.
Referenced by findBasePointers(), and insertParsePoints().
Referenced by analyzeParsePointLiveness().
Referenced by analyzeParsePointLiveness().
|
static |
Referenced by rematerializeLiveValues().
|
explicit |
Definition at line 132 of file RewriteStatepointsForGC.cpp.
|
static |
Referenced by findBaseDefiningValueCached(), and findBasePointer().
1.8.6