15 #define DEBUG_TYPE "dwarfehprepare"
31 STATISTIC(NumResumesLowered,
"Number of resume calls lowered");
40 bool InsertUnwindResumeCalls(
Function &Fn);
50 virtual bool runOnFunction(
Function &Fn);
54 const char *getPassName()
const {
55 return "Exception handling preparation";
63 return new DwarfEHPrepare(TM);
75 bool EraseIVIs =
false;
80 if (ExcIVI && isa<UndefValue>(ExcIVI->
getOperand(0)) &&
99 if (SelLoad && SelLoad->getNumUses() == 0)
100 SelLoad->eraseFromParent();
108 bool DwarfEHPrepare::InsertUnwindResumeCalls(
Function &Fn) {
112 if (
ResumeInst *RI = dyn_cast<ResumeInst>(TI))
121 if (!RewindFunction) {
131 unsigned ResumesSize = Resumes.
size();
133 if (ResumesSize == 1) {
138 Value *ExnObj = GetExceptionObject(RI);
151 "exn.obj", UnwindBB);
156 I = Resumes.
begin(), E = Resumes.
end();
I != E; ++
I) {
161 Value *ExnObj = GetExceptionObject(RI);
176 bool DwarfEHPrepare::runOnFunction(
Function &Fn) {
177 bool Changed = InsertUnwindResumeCalls(Fn);
void push_back(const T &Elt)
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
void addIncoming(Value *V, BasicBlock *BB)
static PassRegistry * getPassRegistry()
LLVMContext & getContext() const
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
FunctionPass * createDwarfEHPass(const TargetMachine *TM)
unsigned getNumIndices() const
void initializeDominatorTreePass(PassRegistry &)
void setCallingConv(CallingConv::ID CC)
STATISTIC(NumResumesLowered,"Number of resume calls lowered")
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=0)
ID
LLVM Calling Convention Representation.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeSet AttributeList)
LLVM Basic Block Representation.
LLVM Constant Representation.
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=0)
static Type * getVoidTy(LLVMContext &C)
Value * getOperand(unsigned i) const
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=0)
idx_iterator idx_begin() const
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=0, BasicBlock *InsertBefore=0)
Creates a new BasicBlock.
LLVM Value Representation.
unsigned getNumUses() const
const BasicBlock * getParent() const