diff options
| author | 2020-08-03 15:06:44 +0000 | |
|---|---|---|
| committer | 2020-08-03 15:06:44 +0000 | |
| commit | b64793999546ed8adebaeebd9d8345d18db8927d (patch) | |
| tree | 4357c27b561d73b0e089727c6ed659f2ceff5f47 /gnu/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp | |
| parent | Add support for UTF-8 DISPLAY-HINTs with octet length. For now only (diff) | |
| download | wireguard-openbsd-b64793999546ed8adebaeebd9d8345d18db8927d.tar.xz wireguard-openbsd-b64793999546ed8adebaeebd9d8345d18db8927d.zip | |
Remove LLVM 8.0.1 files.
Diffstat (limited to 'gnu/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp')
| -rw-r--r-- | gnu/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/gnu/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp b/gnu/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp deleted file mode 100644 index 762a374c135..00000000000 --- a/gnu/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===- EscapeEnumerator.cpp -----------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Defines a helper class that enumerates all possible exits from a function, -// including exception handling. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Transforms/Utils/EscapeEnumerator.h" -#include "llvm/Analysis/EHPersonalities.h" -#include "llvm/Transforms/Utils/Local.h" -#include "llvm/IR/CallSite.h" -#include "llvm/IR/Module.h" -using namespace llvm; - -static Constant *getDefaultPersonalityFn(Module *M) { - LLVMContext &C = M->getContext(); - Triple T(M->getTargetTriple()); - EHPersonality Pers = getDefaultEHPersonality(T); - return M->getOrInsertFunction(getEHPersonalityName(Pers), - FunctionType::get(Type::getInt32Ty(C), true)); -} - -IRBuilder<> *EscapeEnumerator::Next() { - if (Done) - return nullptr; - - // Find all 'return', 'resume', and 'unwind' instructions. - while (StateBB != StateE) { - BasicBlock *CurBB = &*StateBB++; - - // Branches and invokes do not escape, only unwind, resume, and return - // do. - Instruction *TI = CurBB->getTerminator(); - if (!isa<ReturnInst>(TI) && !isa<ResumeInst>(TI)) - continue; - - Builder.SetInsertPoint(TI); - return &Builder; - } - - Done = true; - - if (!HandleExceptions) - return nullptr; - - if (F.doesNotThrow()) - return nullptr; - - // Find all 'call' instructions that may throw. - SmallVector<Instruction *, 16> Calls; - for (BasicBlock &BB : F) - for (Instruction &II : BB) - if (CallInst *CI = dyn_cast<CallInst>(&II)) - if (!CI->doesNotThrow()) - Calls.push_back(CI); - - if (Calls.empty()) - return nullptr; - - // Create a cleanup block. - LLVMContext &C = F.getContext(); - BasicBlock *CleanupBB = BasicBlock::Create(C, CleanupBBName, &F); - Type *ExnTy = StructType::get(Type::getInt8PtrTy(C), Type::getInt32Ty(C)); - if (!F.hasPersonalityFn()) { - Constant *PersFn = getDefaultPersonalityFn(F.getParent()); - F.setPersonalityFn(PersFn); - } - - if (isScopedEHPersonality(classifyEHPersonality(F.getPersonalityFn()))) { - report_fatal_error("Scoped EH not supported"); - } - - LandingPadInst *LPad = - LandingPadInst::Create(ExnTy, 1, "cleanup.lpad", CleanupBB); - LPad->setCleanup(true); - ResumeInst *RI = ResumeInst::Create(LPad, CleanupBB); - - // Transform the 'call' instructions into 'invoke's branching to the - // cleanup block. Go in reverse order to make prettier BB names. - SmallVector<Value *, 16> Args; - for (unsigned I = Calls.size(); I != 0;) { - CallInst *CI = cast<CallInst>(Calls[--I]); - changeToInvokeAndSplitBasicBlock(CI, CleanupBB); - } - - Builder.SetInsertPoint(RI); - return &Builder; -} |
