87 bool NoTrapAfterNoreturn) {
90 if (
Call->isNonContinuableTrap())
95 if (NoTrapAfterNoreturn &&
Call->doesNotReturn())
100 return TrapUnreachable;
107 bool NoTrapAfterNoreturn) {
109 if (TrapUnreachable && !NoTrapAfterNoreturn)
121 NoTrapAfterNoreturn))
131class NVPTXLowerUnreachableLegacyPass :
public FunctionPass {
132 StringRef getPassName()
const override {
133 return "add an exit instruction before every unreachable";
142 void getAnalysisUsage(AnalysisUsage &AU)
const override {
148 NVPTXLowerUnreachableLegacyPass(
bool TrapUnreachable,
149 bool NoTrapAfterNoreturn)
150 : FunctionPass(ID), TrapUnreachable(TrapUnreachable),
151 NoTrapAfterNoreturn(NoTrapAfterNoreturn) {}
154 bool TrapUnreachable;
155 bool NoTrapAfterNoreturn;
159char NVPTXLowerUnreachableLegacyPass::ID = 0;
162 "Lower Unreachable",
false,
false)
166 bool NoTrapAfterNoreturn) {
167 return new NVPTXLowerUnreachableLegacyPass(TrapUnreachable,
168 NoTrapAfterNoreturn);
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static bool runOnFunction(Function &F, bool PostInlining)
static bool lowerUnreachable(Function &F, bool TrapUnreachable, bool NoTrapAfterNoreturn)
static bool isLoweredToTrap(const UnreachableInst &I, bool TrapUnreachable, bool NoTrapAfterNoreturn)
FunctionAnalysisManager FAM
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
FunctionPass class - This class is used to implement most global optimizations.
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
static LLVM_ABI InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT, bool canThrow=false)
InlineAsm::get - Return the specified uniqued inline asm string.
This is an important class for using LLVM in a threaded context.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
This function has undefined behavior.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createNVPTXLowerUnreachableLegacyPass(bool TrapUnreachable, bool NoTrapAfterNoreturn)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto dyn_cast_or_null(const Y &Val)
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.